当前位置: 首页>>代码示例>>C#>>正文


C# Hero类代码示例

本文整理汇总了C#中Hero的典型用法代码示例。如果您正苦于以下问题:C# Hero类的具体用法?C# Hero怎么用?C# Hero使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Hero类属于命名空间,在下文中一共展示了Hero类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Main

        private static void Main(string[] args)
        {
            Player = ObjectMgr.LocalHero;

            // Listen to Events
            Game.OnUpdate += Game_OnUpdate;
        }
开发者ID:ehmehe,项目名称:Ensage,代码行数:7,代码来源:Program.cs

示例2: Start

    public override void Start()
    {
        base.Start();
        if (Application.loadedLevel == 1) { mHero = GameObject.Find("Hero").GetComponent<Hero>(); speed = Random.Range(1, 2.01f); }

        sRender.color = new Color(Random.Range(0.10f, 1.1f), Random.Range(0.10f, 1.1f), Random.Range(0.10f, 1.1f));
    }
开发者ID:AsixJin,项目名称:ISR3-Railroad-Struggle,代码行数:7,代码来源:Troll.cs

示例3: Game_OnUpdate

        private static void Game_OnUpdate(EventArgs args)
        {
            if (Game.IsPaused || Game.IsWatchingGame || !Game.IsInGame)
                return;
            me = ObjectMgr.LocalHero;
            if (me == null)
                return;

            if (!me.IsAlive)
                return;
            Unit Things = ObjectMgr.GetEntities<Unit>()
                .FirstOrDefault(
                    x =>
                        (x.ClassID == ClassID.CDOTA_NPC_Observer_Ward ||
                         x.ClassID == ClassID.CDOTA_NPC_Observer_Ward_TrueSight || x.ClassID == ClassID.CDOTA_NPC_TechiesMines /*|| x.ClassID == ClassID.CDOTA_NPC_Treant_EyesInTheForest*/)
                        && x.Team != me.Team && me.NetworkPosition.Distance2D(x.NetworkPosition) < 450 &&
                        x.IsVisible && x.IsAlive);
            if (!me.IsChanneling() && Utils.SleepCheck("Use"))
            {
                if (Things != null)
                {
                    var useItem = items.Select(item => me.FindItem(item)).FirstOrDefault(x => x != null && x.CanBeCasted());
                    if (useItem != null && !((useItem.Name == "item_tango_single" || useItem.Name == "item_tango") && Things.ClassID == ClassID.CDOTA_NPC_TechiesMines))
                    {
                        useItem.UseAbility(Things);
                        Utils.Sleep(250, "Use");
                    }
                    Utils.Sleep(250, "Use");
                }
            }
        }
开发者ID:jaddyknight,项目名称:EnsageSharp,代码行数:31,代码来源:AutoDeward2.cs

示例4: Attack

    /**
    * {@inheritDoc}
    **/
    public override void Attack(Hero target)
    {
        //CurrentAttackSpeed

        if(LastAttack + CurrentAttackSpeed < Time.time )
        {
            Vector3 vectorToTarget = target.transform.position - transform.position;
            vectorToTarget.z = -vectorToTarget.z;
            //Debug.Log("Dragonnet:"+vectorToTarget);
            //transform.rotation = Quaternion.Slerp(transform.rotation,Quaternion.LookRotation(Camera.main.transform.position),10f);
            GetComponentInChildren<Animation>().CrossFadeQueued("Attack",0.2f);
            PlayAttackSound();
            NbAttack = NbAttack+1;
            LastAttack = Time.time;
            //add attacking BV
            if (fireball == null)
            {
                //loading fireball in the dragonnet
                fireball = Instantiate(fireballGo);
                //fireball.GetComponentInChildren<HeroLinkWeapon>().Hero = hero;
                fireball.transform.parent = transform; //need to attach to this
                //get the lifebar position because dragonnet position is messed up
                fireball.transform.position = this.transform.position; //GetComponentInChildren<Canvas>().transform.position;
                fireball.transform.localPosition = new Vector3(0, 2.3f, 0);
                //fireball.transform.localPosition = new Vector3(0f, 0f, 0f);

            }
        }
    }
开发者ID:ifgx,项目名称:scripts-spr3,代码行数:32,代码来源:Dragonet.cs

示例5: Tick

 public static void Tick(EventArgs args)
 {
     if (!Game.IsInGame || Game.IsPaused || Game.IsWatchingGame || Game.IsChatOpen)
         return;
     me = ObjectMgr.LocalHero;
     if (me == null)
         return;
     if (me.IsAlive)
     {
         FindItems();
         PercentStickUse = ((double)Menu.Item("Percent Configuration").GetValue<Slider>().Value / 100);
         if ( item_bottle != null && (!me.IsInvisible() || me.ClassID == ClassID.CDOTA_Unit_Hero_Riki) && !me.IsChanneling() && me.Modifiers.Any(x => x.Name == "modifier_fountain_aura_buff") && _item_config.Item("Items: ").GetValue<AbilityToggler>().IsEnabled(item_bottle.Name) && Utils.SleepCheck("bottle"))
         {
             if(!me.Modifiers.Any(x => x.Name == "modifier_bottle_regeneration") && (me.Health < me.MaximumHealth || me.Mana < me.MaximumMana))
                 item_bottle.UseAbility(false);
             Alies = ObjectMgr.GetEntities<Hero>().Where(x => x.Team == me.Team && x != me && (x.Health < x.MaximumHealth || x.Mana < x.MaximumMana) && !x.Modifiers.Any(y => y.Name == "modifier_bottle_regeneration") && x.IsAlive && !x.IsIllusion && x.Distance2D(me) <= item_bottle.CastRange).ToList();
             foreach (Hero v in Alies)
                 if (v != null)
                     item_bottle.UseAbility(v,false);
             Utils.Sleep(300, "bottle");
         }
         if (item_phase_boots != null && (!me.IsInvisible() || me.ClassID == ClassID.CDOTA_Unit_Hero_Riki) && !me.IsChanneling() && item_phase_boots.CanBeCasted() && me.NetworkActivity == NetworkActivity.Move && _item_config.Item("Items: ").GetValue<AbilityToggler>().IsEnabled(item_phase_boots.Name) && Utils.SleepCheck("phaseboots"))
         {
             item_phase_boots.UseAbility(false);
             Utils.Sleep(300, "phaseboots");
         }
         if (item_magic_stick != null && (!me.IsInvisible() || me.ClassID == ClassID.CDOTA_Unit_Hero_Riki) && !me.IsChanneling() && item_magic_stick.CanBeCasted() && item_magic_stick.CurrentCharges > 0 && (double)me.Health / me.MaximumHealth < PercentStickUse && _item_config.Item("Items: ").GetValue<AbilityToggler>().IsEnabled(item_magic_stick.Name))
             item_magic_stick.UseAbility(false);
         if (item_magic_wand != null && (!me.IsInvisible() || me.ClassID == ClassID.CDOTA_Unit_Hero_Riki) && !me.IsChanneling() &&  item_magic_wand.CanBeCasted() && item_magic_wand.CurrentCharges > 0 && (double)me.Health / me.MaximumHealth < PercentStickUse && _item_config.Item("Items: ").GetValue<AbilityToggler>().IsEnabled(item_magic_wand.Name))
             item_magic_wand.UseAbility(false);
     }
 }
开发者ID:jaddyknight,项目名称:EnsageSharp,代码行数:32,代码来源:AutoItems_NINJA.cs

示例6: BestAutoAttackTarget

 /// <summary>
 ///     Find enemy hero that takes least hits to kill
 /// </summary>
 /// <param name="source">Source hero</param>
 /// <returns></returns>
 public static Hero BestAutoAttackTarget(Hero source)
 {
     var attackRange = source.GetAttackRange();
     var enemyHeroes =
         ObjectMgr.GetEntities<Hero>()
             .Where(
                 x =>
                 x.Team == source.GetEnemyTeam() && !x.IsIllusion && x.IsAlive && x.IsVisible
                 && x.Distance2D(source) <= (attackRange + x.HullRadius + source.HullRadius + 50));
     var aaDmg = source.MinimumDamage + source.BonusDamage;
     Hero bestTarget = null;
     var lastHitsToKill = 0f;
     foreach (var enemyHero in enemyHeroes)
     {
         var takenDmg = enemyHero.DamageTaken(aaDmg, DamageType.Physical, source, false);
         var hitsToKill = enemyHero.Health / takenDmg;
         if (bestTarget != null && !(lastHitsToKill > hitsToKill))
         {
             continue;
         }
         bestTarget = enemyHero;
         lastHitsToKill = hitsToKill;
     }
     return bestTarget;
 }
开发者ID:MarkHC,项目名称:Ensage.Common,代码行数:30,代码来源:TargetSelector.cs

示例7: CreateHero

    public Hero CreateHero(HeroClass heroClass)
    {
        Hero hero = new Hero();
        hero.heroName = Strings.RandomNameForClass(heroClass);
        hero.heroClass = heroClass;

        switch (heroClass) {
        case HeroClass.WARRIOR:
            hero.strength = 10;
            hero.dexterity = 5;
            hero.intelligence = 3;
            hero.vitality = 8;

            hero.weapon = GameManager.I.weaponLib.GetWeapon("Sword_Rusty");
            break;
        case HeroClass.BARBARIAN:
            hero.strength = 12;
            hero.dexterity = 4;
            hero.intelligence = 2;
            hero.vitality = 8;

            hero.weapon = GameManager.I.weaponLib.GetWeapon("Hammer_Rusty");
            break;
        case HeroClass.ASSASSIN:
            hero.strength = 6;
            hero.dexterity = 9;
            hero.intelligence = 3;
            hero.vitality = 5;
            break;
        case HeroClass.RANGER:
            hero.strength = 2;
            hero.dexterity = 12;
            hero.intelligence = 4;
            hero.vitality = 2;
            break;
        case HeroClass.WIZARD:
            hero.strength = 1;
            hero.dexterity = 6;
            hero.intelligence = 12;
            hero.vitality = 3;
            break;
        case HeroClass.PRIEST:
            hero.strength = 5;
            hero.dexterity = 2;
            hero.intelligence = 10;
            hero.vitality = 4;
            break;
        default:
            break;
        }

        hero.level = 1;
        hero.maxMana = CalculateMaxMana(hero.intelligence);
        hero.maxHP = CalculateMaxHP(hero.vitality);

        hero.position = GameManager.I.status.heroes.Count;
        hero.id = GameManager.I.status.heroes.Count;

        return hero;
    }
开发者ID:torybash,项目名称:DungeonRaiders,代码行数:60,代码来源:HeroHelper.cs

示例8: HeroPositionChange

    public void HeroPositionChange(Hero hero, int change)
    {
        Debug.Log("HeroPositionUp -- BEFORE - hero.pos: " + hero.position);

        foreach (var item in GameManager.I.status.heroes) {
            print ("hero: " + item.heroName + " , pos: "+ item.position);
        }

        //Change position for other hero (who was in the new position)
        Hero otherHero = GameManager.I.status.heroes.Find(x => x.position == (hero.position + change));
        otherHero.position -= change;
        heroCommanders[otherHero.id].PositionChanged();

        //Change position for hero
        hero.position += change;
        heroCommanders[hero.id].PositionChanged();

        print ("AFTER - hero.pos: " + hero.position);
        foreach (var item in GameManager.I.status.heroes) {
            print ("hero: " + item.heroName + " , pos: "+ item.position);
        }

        //Update UI
        gameCtrl.gameUICtrl.UpdateGameHeroesPanel();
    }
开发者ID:torybash,项目名称:DungeonRaiders,代码行数:25,代码来源:UnitController.cs

示例9: Battle

        public Battle()
        {
            if (story == null)
            {
                this.story = App.Story;
                this.hero = story.Hero;
                currentStatus = null;
            }

            InitializeComponent();

            buttons = new Dictionary<Type, Button>()
            {
                {typeof (Rock), RockButton},
                {typeof (Paper), PaperButton},
                {typeof (Scissors), ScissorsButton},
            };

            foreach (var button in buttons.Values)
            {
                button.Visibility = Visibility.Collapsed;
            }

            returnToNavi.Visibility = Visibility.Collapsed;

            RunBattle();
        }
开发者ID:Turrino,项目名称:RPS,代码行数:27,代码来源:Battle.xaml.cs

示例10: OnTriggerEnter

 void OnTriggerEnter(Collider other)
 {
     hero = other.gameObject.GetComponent<Hero>();
     if (hero == null) return;
     enter = true;
     hero = other.gameObject.GetComponent<Hero>();
 }
开发者ID:DanielParra159,项目名称:GGJ2016,代码行数:7,代码来源:MovableTrigger.cs

示例11: Game_OnUpdate

        private static void Game_OnUpdate(EventArgs args)
        {
            if (target == null) return;
            if (!_loaded)
            {
                if (!Game.IsInGame || me == null || me.ClassID != ClassID.CDOTA_Unit_Hero_PhantomAssassin)
                {
                    return;
                }
            }
                _loaded = true;

                Game.PrintMessage(
                "<font face='Comic Sans MS, cursive'><font color='#00aaff'>" + Menu.DisplayName + " By Bopby" +
                " loaded!</font> <font color='#aa0000'>v" + Assembly.GetExecutingAssembly().GetName().Version,
                MessageType.LogMessage);

            me = ObjectMgr.LocalHero;
            target = me.ClosestToMouseTarget(Menu.Item("targetsearchrange").GetValue<Slider>().Value);
            var handle = me.Handle;
            var distance = me.Distance2D(target);
            var inv = me.Inventory.Items;
            var enumerable = inv as Item[] ?? inv.ToArray();
            var dagger = enumerable.Any(x => x.Name == "item_blink" && x.Cooldown == 0);
            if (!me.IsAlive) return
                    ;
            if (target != null && Menu.Item("keyBind").GetValue<KeyBind>().Active == true)
            {
                SpellsUsage(me, target, distance, dagger);
            }
        }
开发者ID:binhbumpro,项目名称:ensagexxx,代码行数:31,代码来源:Program.cs

示例12: ProcessHero

    public void ProcessHero(Hero hero)
    {
        // get reference
        int totalPoints = 0;
        DungeonFloor floor = floors [currentFloor];

        // calculate total points
        foreach (Item it in hero.H_Inventory) {
            if(floor.checkIfGoodItem(it.name)){
                totalPoints += 50;
            }
            if(floor.checkIfBadItem(it.name)){
                totalPoints -= 30;
            }
        }
        if (hero.HeroClass == floor.goodClass) {
            totalPoints += 20;
        }
        if (hero.HeroClass == floor.badClass) {
            totalPoints -= 20;
        }
        Destroy (hero);

        if (floor.levelPoints > 0) {
            floor.levelPoints -= totalPoints;
        } else {
            floor.bossPoints -= totalPoints;
        }

        if (floor.bossPoints < 0) {
            currentFloor++;
        }
    }
开发者ID:huangc8,项目名称:LifeOfNPC,代码行数:33,代码来源:Dungeon.cs

示例13: Init

 public void Init(Hero hero)
 {
     this.hero = hero;
     herostart = hero.transform.position;
     linerenderes = new GameObject[CurrentGameState.completedLevelLocations.Count - 1];
     GameObject lr;
     for (int i = 0; i < CurrentGameState.completedLevelLocations.Count - 1; i++)
     {
         lr = new GameObject();
         lr.AddComponent<LineRenderer>();
         SetupLineRenderer(lr.GetComponent<LineRenderer>(), CurrentGameState.completedLevelLocations[i], CurrentGameState.completedLevelLocations[i + 1]);
         linerenderes[i] = lr;
     }
     if (hero != null)
     {
         lr = new GameObject();
         lr.AddComponent<LineRenderer>();
         SetupLineRenderer(lr.GetComponent<LineRenderer>(), herostart, hero.transform.position);
         herolinerenderer = lr;
         herolinerenderer.GetComponent<LineRenderer>().enabled = false;
     }
     if (origin != null)
     {
         lr = new GameObject();
         lr.AddComponent<LineRenderer>();
         SetupLineRenderer(lr.GetComponent<LineRenderer>(), origin.transform.position, firstPosition.transform.position);
         firstlinerenderer = lr;
     }
 }
开发者ID:Crismis333,项目名称:MSU_TheSiege2,代码行数:29,代码来源:PreviousLines.cs

示例14: CalculateManaRequired

        public static int CalculateManaRequired(Hero me)
        {
            try
            {
                if (Utils.SleepCheck("manaCalcErrorTimeout"))
                {
                    var hook = me.Spellbook.Spell1;
                    var dismember = me.Spellbook.SpellR;
                    var urn = me.FindItem("item_urn_of_shadows");
                    var eblade = me.FindItem("item_ethereal_blade");
                    var dagon = me.GetDagon();
                    var ManaRequired = 0;

                    if (hook != null)
                        ManaRequired += (int)hook.ManaCost;
                    if (dismember != null)
                        ManaRequired += (int)dismember.ManaCost;
                    if (eblade != null)
                        ManaRequired += (int)eblade.ManaCost;
                    if (dagon != null)
                        ManaRequired += (int)dagon.ManaCost;
                    return (int)ManaRequired;
                }
                return 0;
            }
            catch (Exception ex)
            {
                // Print.Error("MANACALC: " + ex.Message);
                Utils.Sleep(500, "manaCalcErrorTimeout");
                return 0;
            }
        }
开发者ID:NadeHouse,项目名称:Pudge-Plus,代码行数:32,代码来源:HookHandler.cs

示例15: GetChaseTree

        public Tree GetChaseTree(
            Hero hero,
            Target target,
            TimberChain timberChain,
            float maxDistanceToEnemy,
            float minDistanceToHero)
        {
            var castRange = timberChain.GetCastRange();
            var targetPosition = target.GetPosition();

            var targetDistance = target.GetDistance(hero.Position);
            var ignoreMaxDistance = targetDistance > castRange + 200;

            var delay = Game.RawGameTime + timberChain.CastPoint + Game.Ping / 1000;
            var trees = GetAvailableTrees(hero, targetPosition, castRange, delay, timberChain.Speed).ToList();

            return
                trees.Where(
                    x =>
                    (ignoreMaxDistance
                     || x.Distance2D(
                         TimberPrediction.PredictedXYZ(
                             target,
                             timberChain.CastPoint + x.Distance2D(targetPosition) / timberChain.Speed))
                     <= maxDistanceToEnemy
                     || (target.Hero.GetTurnTime(x.Position) <= 0 && x.Distance2D(targetPosition) < 600))
                    && x.Distance2D(hero) >= minDistanceToHero)
                    .FirstOrDefault(
                        z =>
                        trees.Where(x => !x.Equals(z))
                            .All(
                                x =>
                                x.Distance2D(hero) > 150 && !IsPointOnLine(x.Position, hero.Position, z.Position, 25)));
        }
开发者ID:IdcNoob,项目名称:Ensage,代码行数:34,代码来源:TreeFactory.cs


注:本文中的Hero类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。