Ejemplo n.º 1
0
        private IEnumerator WaitForAttackAnimation(Animation animation)
        {
            var skillStateMachine = SkillLogic.CreateSkillStateMachine(GetAttr().gameObject, activeSkill.skillData, tower.transform.position);

            skillStateMachine.SetForwardDirection(forward);
            //skillStateMachine.SetRelativePos(tower.localPosition);

            Log.AI("Wait For Combat Animation");
            float passTime = 0;

            //yield return new WaitForSeconds(0.1f);
            yield return(null);

            MyEventSystem.PushLocalEventStatic(GetAttr().GetLocalId(), MyEvent.EventType.EventTrigger);
            var realAttackTime = activeSkill.skillData.AttackAniTime / GetAttr().GetSpeedCoff();

            //realAttackTime -= 0.3f;
            do
            {
                if (passTime >= realAttackTime * 0.8f)
                {
                    break;
                }
                passTime += Time.deltaTime;

                yield return(null);
            } while(!quit);

            Log.Ani("Animation is Playing stop ");
            skillStateMachine.Stop();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 和使用普通技能一样
        /// </summary>
        public void PlayerAttack()
        {
            //连击3招
            var meId      = ObjectManager.objectManager.GetMyAttr().GetNetView().GetLocalId();
            var skillInfo = ObjectManager.objectManager.GetMyPlayer().GetComponent <SkillInfoComponent>();

            skillInfo.SetDefaultActive();

            var skillData = skillInfo.GetActiveSkill().skillData;
            var curState  = ObjectManager.objectManager.GetMyPlayer().GetComponent <AIBase>().GetAI().state;

            //无动作技能释放 不用检测
            if (string.IsNullOrEmpty(skillData.AnimationName))
            {
            }
            else
            {
                //当前状态不能使用技能 或者已经在技能状态了不能连续点击
                if (curState != null)
                {
                    var ret = curState.CanChangeState(AIStateEnum.CAST_SKILL);
                    if (!ret)
                    {
                        return;
                    }
                }
            }

            if (curState != null && curState.type == AIStateEnum.DEAD)
            {
                Util.ShowMsg("死亡不能使用技能");
                return;
            }
            //默认技能上次使用频率控制

            MyEventSystem.PushLocalEventStatic(meId, MyEvent.EventType.UseSkill);
            var skillId = skillInfo.GetActiveSkill().skillId;

            /*
             * //如果身上有Buff则调整默认技能的ID
             * if (!NetworkUtil.IsNet())
             * {
             *  ObjectManager.objectManager.GetMyPlayer().GetComponent<MyAnimationEvent>().OnSkill(skillData);
             * }
             *
             * if (skillInfo.GetActiveSkill().skillData.skillConfig.stopMove)
             * {
             *  //短时间限制自己移动
             *  var me = ObjectManager.objectManager.GetMyPlayer();
             *  GameInterface_Skill.AddSkillBuff(me.gameObject, "StopMoveBuff", Vector3.zero);
             * }
             *
             * NetDateInterface.FastMoveAndPos();
             */

            NetDateInterface.FastUseSkill(skillId, skillData.Level);
        }
Ejemplo n.º 3
0
        public override IEnumerator RunLogic()
        {
            tower       = GetAttr().GetComponent <TankPhysicComponent>().tower.transform;
            tower2      = Util.FindChildRecursive(tower, "tower2").gameObject;
            activeSkill = GetAttr().GetComponent <SkillInfoComponent>().GetActiveSkill();
            var skInfo = GetAttr().GetComponent <SkillInfoComponent>();

            MyEventSystem.PushLocalEventStatic(GetAttr().GetNetView().GetLocalId(), MyEvent.EventType.UseSkill);
            yield return(GetAttr().StartCoroutine(Shoot()));
        }
Ejemplo n.º 4
0
 public void SetIsMasterNet(bool isMaster)
 {
     Log.Sys("IsMasterNet: " + isMaster);
     IsMaster = isMaster;
     MyEventSystem.PushLocalEventStatic(GetLocalId(), MyEvent.EventType.IsMaster);
 }
Ejemplo n.º 5
0
 public void SetTeamColorNet(int teamColor)
 {
     TeamColor = teamColor;
     MyEventSystem.PushLocalEventStatic(GetLocalId(), MyEvent.EventType.TeamColor);
     SetTeamShader();
 }
Ejemplo n.º 6
0
        private IEnumerator WaitForAttackAnimation(Animation animation)
        {
            List <SkillStateMachine> sm = new List <SkillStateMachine>();
            GameObject targetPlayer     = null;
            var        target           = skillAction.Target;

            if (target != 0)
            {
                targetPlayer = ObjectManager.objectManager.GetPlayer(target);
            }
            if (GetAttr().GetComponent <BuffComponent>().HasLianFa())
            {
                Log.Sys("LianFaShoot:");

                var skillStateMachine = SkillLogic.CreateSkillStateMachine(GetAttr().gameObject, activeSkill.skillData,
                                                                           skillPos, targetPlayer);
                skillStateMachine.SetForwardDirection(forward);
                skillStateMachine.SetDelay();
                skillStateMachine.SetStaticShoot(IsStatic);
                sm.Add(skillStateMachine);

                skillStateMachine = SkillLogic.CreateSkillStateMachine(GetAttr().gameObject, activeSkill.skillData,
                                                                       skillPos, targetPlayer);
                skillStateMachine.SetForwardDirection(forward);
                sm.Add(skillStateMachine);
            }
            else
            {
                var skillStateMachine = SkillLogic.CreateSkillStateMachine(GetAttr().gameObject, activeSkill.skillData,
                                                                           skillPos, targetPlayer);
                skillStateMachine.SetForwardDirection(forward);
                skillStateMachine.SetStaticShoot(IsStatic);
                sm.Add(skillStateMachine);
            }

            Log.AI("Wait For Combat Animation");
            float passTime = 0;

            //yield return new WaitForSeconds(0.1f);
            yield return(null);

            MyEventSystem.PushLocalEventStatic(GetAttr().GetLocalId(), MyEvent.EventType.EventTrigger);
            var realAttackTime = activeSkill.skillData.AttackAniTime / GetAttr().GetSpeedCoff();

            GetAttr().StartCoroutine(ShootAni(realAttackTime * 0.8f));
            //realAttackTime -= 0.3f;
            do
            {
                if (passTime >= realAttackTime * 0.8f)
                {
                    break;
                }
                passTime += Time.deltaTime;

                yield return(null);
            } while (!quit);

            Log.Ani("Animation is Playing stop ");
            foreach (var skillStateMachine in sm)
            {
                skillStateMachine.Stop();
            }
        }