Пример #1
0
    /// <summary>
    /// Creates an attack state.  The complete function is provided if the attack state is interrupted. It's
    /// intended to be run on interrupt (to close additional resources / reset state).
    /// </summary>
    public static AttackState create(IEnumerator coroutine, bool interruptable, CompleteFunction completeFunction)
    {
        AttackState attackState = ScriptableObject.CreateInstance <AttackState>();

        attackState.init(coroutine, interruptable, completeFunction);
        return(attackState);
    }
Пример #2
0
    /// <summary>
    /// 动画回调
    /// </summary>
    public void animationCall(int type)
    {
        //Debug.Log(gameObject.name + _data.Country + "士兵动画回调" + type);

        //根据返回的类别进行处理
        if (type == GeneralSoldier.HIT_THE_POINT_CALL_BACK) //进入打击点
        {
            //对方掉血
            bool isDead = SpriteMgr.getInstance().hit(this);

            //目标是否死亡
            if (isDead)
            {
                //将自己目标置空
                _data.AttackTarget = null;
            }
            return;
        }

        //本次攻击结束
        if (type == GeneralSoldier.HIT_THE_END_CALL_BACK)
        {
            AttackState.init();
            return;
        }

        //死亡动画播放完毕
        if (type == GeneralSoldier.DEAD_OVER_CALL_BACK)
        {
            string debugName = this.name;
            GameObject.Destroy(this.gameObject);       //销毁
            return;
        }

        //受攻击动画播放完毕
        if (type == GeneralSoldier.HURT_OVER_CALL_BACK)
        {
            //进入锁敌状态
            setState(_walkState);
            return;
        }
    }
Пример #3
0
    /// <summary>
    /// 动画回调
    /// </summary>
    public void animationCall(int type)
    {
        if (_data.Country == Defaults.Country.Me)
        {
            //Debug.Log(_data.Country + "士兵动画回调" + type);
        }

        //根据返回的类别进行处理
        switch (type)
        {
        case GeneralSoldier.HIT_THE_POINT_CALL_BACK:        //进入打击点

            //_data.SkillMgr.setSkills(this);
            //_data.SkillMgr.play(_data.Skills[0]);
            //   _data.SkillMgr.play(1005);

            //对方掉血
            bool isDead = SpriteMgr.getInstance().hit(this);

            //目标是否死亡
            if (isDead)
            {
                //将自己目标置空
                _data.AttackTarget = null;
            }
            break;

        case GeneralSoldier.HIT_THE_END_CALL_BACK:         //本次攻击结束
            AttackState.init();
            break;

        case GeneralSoldier.DEAD_OVER_CALL_BACK:      //死亡动画播放完毕
            GameObject.Destroy(this.gameObject);      //销毁
            break;

        case GeneralSoldier.HURT_OVER_CALL_BACK:           //受攻击动画播放完毕
            //进入锁敌状态
            setState(_walkState);
            break;
        }
    }