コード例 #1
0
    public override void Action(GameObject target)
    {
        base.Action(target);

        _cardAction         = target.GetComponent <HeroAttack>();
        _cardAction.enabled = true;
    }
コード例 #2
0
    void Die()
    {
        HeroAttack playerAttack = player.GetComponent <HeroAttack>();

        playerAttack.isTargeting = false;

        arenaManager.gainedNotoriety += enemyStats.worthNotoriety;

        if (arenaManager.enemies.Contains(gameObject))
        {
            arenaManager.enemies.Remove(gameObject);
            if (arenaManager.enemies.Count == 0)
            {
                Debug.Log("All enemies eliminated");
                arenaManager.ActivitySuccess();
            }
        }

        GetComponent <Rigidbody>().useGravity = false;
        enemyNav.enabled = false;
        GetComponent <Collider>().isTrigger = true;

        enemyAnim.StopPlayback();
        enemyAnim.SetBool("IsDead", true);

        //Destroy(gameObject);
    }
コード例 #3
0
 public void ShowHeroState(HeroFightUnit hero)
 {
     healthBar.value = hero.healthValue;
     manaBar.value   = hero.manaValue;
     if (healthBar.value <= 0.2)
     {
         healthBar.foregroundWidget.color = Color.red;
     }
     else if (healthBar.value > 0.2 && healthBar.value <= 0.5)
     {
         healthBar.foregroundWidget.color = new Color(1f, 0.75f, 0f, 1f);
     }
     if (hero.attack != null)
     {
         HeroAttack attack = (HeroAttack)hero.attack;
         if (attack.normalSkill.time != 0)
         {
             cdlabel.text = Mathf.RoundToInt(attack.normalSkill.time).ToString();
         }
         else
         {
             cdlabel.text = string.Empty;
         }
     }
     if (HeadshotIcon.color.g == 0f && count == 3)
     {
         HeadshotIcon.color = Color.white;
         count = 0;
     }
     else if (HeadshotIcon.color.g == 0f)
     {
         count++;
     }
 }
コード例 #4
0
 public void InitAttack()
 {
     if (BattleFieldManager.Instance.MyPlayerIndex != 0)
     {
         _HeroAtk = BattleFieldManager.Instance.GetEntity(BattleFieldManager.Instance.MyPlayerIndex).GetComponent <HeroAttack>();
     }
 }
コード例 #5
0
 private void InitHeroModel()
 {
     OrinHealth    = Health;
     SpawnPos      = transform.position;
     Hero_Animator = GetComponent <Animator>();
     Hero_Attack   = GetComponent <HeroAttack>();
     Hero_Move     = GetComponent <HeroMove>();
 }
コード例 #6
0
    private void Awake()
    {
        ChangeMaterial(initMaterial);

        if (ally == kindOfAlly.hero)
        {
            heroAttack = GetComponentInChildren <HeroAttack>();
        }
    }
コード例 #7
0
ファイル: FsmTest.cs プロジェクト: zhoulk/Lufy
    // Start is called before the first frame update
    void Start()
    {
        m_FsmManager = GetComponent <FsmManager>();

        FsmState <FsmTest>[] states = new FsmState <FsmTest> [3];
        states[0] = new HeroRun();
        states[1] = new HeroIdle();
        states[2] = new HeroAttack();
        m_HeroFsm = m_FsmManager.CreateFsm(this, states);
        m_HeroFsm.Start(typeof(HeroRun));
    }
コード例 #8
0
    /// <summary>
    /// 替换头像控件绑定
    /// </summary>
    /// <param name="oldHero"></param>
    /// <param name="newHero"></param>
    public void ReplaceHeadShot(HeroFightUnit oldHero, HeroFightUnit newHero)
    {
        HeadShotWidget headShot = HeadShotMapper[oldHero];

        HeadShotMapper.Remove(oldHero);
        HeadShotMapper.Add(newHero, headShot);
        headShot.HeadshotIcon.spriteName = Util.GetConfigString(newHero.heroData.icon);
        headShot.SetShuxing((HurtType)newHero.heroData.element);
        HeroAttack attack = newHero.GetComponent <HeroAttack>();

        headShot.onClick = attack.UI_UseActiveSkill;
        headShot.onDrag  = attack.UI_UseUniqueSkill;
    }
コード例 #9
0
    /// <summary>
    /// 绑定英雄头像控件
    /// </summary>
    /// <param name="unit"></param>
    /// <param name="i"></param>
    public void RegesterHeadShot(HeroFightUnit unit, int i)
    {
        string         key      = i + HeadShotWidget.nameExtension;
        HeadShotWidget headShot = (HeadShotWidget)widgetsMap[key];

        HeadShotMapper.Add(unit, headShot);
        headShot.HeadshotIcon.spriteName = Util.GetConfigString(unit.heroData.icon);
        headShot.SetShuxing((HurtType)unit.heroData.element);
        HeroAttack attack = unit.GetComponent <HeroAttack>();

        headShot.onClick = attack.UI_UseActiveSkill;
        headShot.onDrag  = attack.UI_UseUniqueSkill;
        headShot.gameObject.SetActive(true);
    }
コード例 #10
0
 public void ShowHeroState(HeroFightUnit hero)
 {
     healthBar.value = hero.healthValue;
     manaBar.value   = hero.manaValue;
     if (hero.attack != null)
     {
         HeroAttack attack = (HeroAttack)hero.attack;
         if (attack.normalSkill.time != 0)
         {
             cdlabel.text = Mathf.RoundToInt(attack.normalSkill.time).ToString();
         }
         else
         {
             cdlabel.text = string.Empty;
         }
     }
 }
コード例 #11
0
ファイル: Health.cs プロジェクト: SeFFoFF/RedCloak-Game
    void enabledMoving()
    {
        this.gameObject.GetComponent <CapsuleCollider2D>().isTrigger = true;

        GameObject  hero = GameObject.Find("main_hero");
        HeroControl move = hero.GetComponent <HeroControl>();

        move.enabled = false;

        HeroJump jump = hero.GetComponent <HeroJump>();

        jump.enabled = false;

        HeroAttack attack = hero.GetComponent <HeroAttack>();

        attack.enabled = false;
    }
コード例 #12
0
    /// <summary>
    /// 实例化所有作战单位
    /// </summary>
    public void InstUnits()
    {
        HealthUIManager.instance.ResetDepth();
        for (int i = 0; i < PlayerData.GetInstance().CurrentFightHero.Count; i++)
        {
            int        id            = PlayerData.GetInstance().CurrentFightHero[i];
            string     heroModelName = Encoding.Default.GetString(heroDataDic[id].model);
            GameObject child         = AssetManager.GetGameObject(heroModelName, battle_points[i]);
            if (heroDataDic[id].direction == 1)
            {
                child.transform.Rotate(new Vector3(0, 180, 0));
            }
            child.transform.parent = transform.parent;
            child.layer            = gameObject.layer;
            unit = child.AddComponent <HeroFightUnit>();
            fightUnits.Add(unit);
            unit.parentGroup = this;
            unit.orinPoint   = battle_points[i];
            //赋值战斗属性
            unit.heroData      = heroDataDic[id];
            unit.heroEvolution = heroEvolution[110]; //假定品质1,星级0
            unit.level         = 1;                  //假定等级是1
            unit.InitFightAttribute();
            //赋值技能id
            HeroAttack heroAttack = child.GetComponent <HeroAttack>();
            heroAttack.normalAttackId = (int)heroDataDic[id].attackID;
            heroAttack.normalSkillId  = (int)heroDataDic[id].normalSkill;
            heroAttack.specailSkillId = (int)heroDataDic[id].specialSkill;
            //生成血条UI
            Transform healthBarPos = child.transform.Find("blood");
            HealthUIManager.instance.AddNewHealthBar(fightUnits[i], healthBarPos, group == GroupType.Enemy);
            //绑定人物头像
            ViewMapper <FightPanel> .instance.RegesterHeadShot(unit, i);

            unit.OnGotHit += OnHeadPicShake;
            anim           = ViewMapper <FightPanel> .instance.HeadShotMapper[unit].anim_headpic;
            headcolor      = ViewMapper <FightPanel> .instance.HeadShotMapper [unit].headcolor;
            //记录初始数值
            DungeonRecord.totalHp += unit.fightAttribute.health;
        }

        /* 赋值备战单位
         * 记录初始数值*/
    }
コード例 #13
0
ファイル: FightManager.cs プロジェクト: foolishfool/Spine
    /// <summary>
    /// 自动使用绝技
    /// </summary>
    public void TryUseUniqueSkill()
    {
        if (FightEnergy.instance.EnergyVal < needEnergy || FightEnergy.instance.EnergyUseVal != 0 || mineGroup.fightUnits.Count == 0)
        {
            return;
        }
        List <HeroAttack> heroAttacks = new List <HeroAttack>();

        for (int i = 0; i < mineGroup.fightUnits.Count; i++)
        {
            HeroAttack attack = (HeroAttack)mineGroup.fightUnits[i].attack;
            if (attack.specailSkill == null || attack.specailSkill.specialSkill.skillType == (uint)SkillType.Cure)
            {
                continue;
            }
            heroAttacks.Add(attack);
        }
        heroAttacks.Sort(delegate(HeroAttack a, HeroAttack b){ return(a.specailSkill.specialSkill.weight.CompareTo(b.specailSkill.specialSkill.weight)); });
        int usedNum = 0;

        for (int i = heroAttacks.Count - 1; i >= 0; i--)
        {
            if (Random.value * 10000 <= heroAttacks[i].specailSkill.specialSkill.weight * DecisionFactorDic[usedNum + 1].factor)
            {
                if (heroAttacks[i].self.state == FightUnit.UnitState.Fighting)
                {
                    usedNum++;
                    heroAttacks[i].AutoUseUniqueSkill();
                }
            }
        }
        if (usedNum == 0 && heroAttacks.Count > 0 && heroAttacks[0].self.state == FightUnit.UnitState.Fighting)
        {
            heroAttacks[0].AutoUseUniqueSkill();
        }
    }
コード例 #14
0
 // Use this for initialization
 void Start()
 {
     foreach (CapsuleCollider rs in this.gameObject.GetComponentsInChildren<CapsuleCollider>())
     {
         rs.isTrigger = true;
     }
     foreach (BoxCollider rs in this.gameObject.GetComponentsInChildren<BoxCollider>())
     {
         rs.isTrigger = true;
     }
     foreach (SphereCollider rs in this.gameObject.GetComponentsInChildren<SphereCollider>())
     {
         rs.isTrigger = true;
     }
     foreach (Rigidbody rs in this.gameObject.GetComponentsInChildren<Rigidbody>())
     {
         rs.Sleep();
     }
     currentSpeed = MoveSpeed;
     dead = false;
     defaultRot = transform.rotation;
     complete = false;
     anim = gameObject.GetComponent<Animator>();
     GUI = Camera.mainCamera.GetComponent<GUIScript>();
     am = GameObject.Find("FellowHeroes").GetComponent<ArmyMovement>();
     ha = gameObject.GetComponent<HeroAttack>();
 }
コード例 #15
0
ファイル: GrappleHook.cs プロジェクト: uraffululz/HeroSupport
 void OnEnable()
 {
     player    = GameObject.FindGameObjectWithTag("Player");
     heroAtk   = player.GetComponent <HeroAttack>();
     hookSpawn = transform.parent;
 }
コード例 #16
0
ファイル: hit.cs プロジェクト: Mateaus/NotAFunGuy
 // Start is called before the first frame update
 void Start()
 {
     attack = GetComponentInParent <HeroAttack>();
 }