//[Range (0.01f, 1f)]
        //public float ComboInputStartTime = 0.3f;
        //[Range (0.01f, 1f)]
        //public List<float> ComboInputInterval = new List<float> {0f, 1f};
        //public float ComboInputEndTime = 0.7f;

        //public List<AttackType> AttackParts = new List<AttackPartType> ();
        //public List<AttackInfo> FinishedAttacks = new List<AttackInfo> ();

        public override void OnEnter(StatewithEffect stateEffect, Animator animator, AnimatorStateInfo stateInfo)
        {
            if (animator.GetBool(TransitionParameter.Charge.ToString()) || NotNeedCharge)
            {
                if (stateEffect.CharacterControl.CharacterData.Energy >= EnergyTaken)
                {
                    stateEffect.CharacterControl.TakeEnergy(EnergyTaken, this);
                    GameObject obj     = PoolManager.Instance.GetObject(PoolObjectType.AttackInfo);
                    AttackInfo atkInfo = obj.GetComponent <AttackInfo> ();
                    atkInfo.Init(null, this, stateEffect.CharacterControl);
                    obj.SetActive(true);
                    AttackManager.Instance.CurrentAttackInfo.Add(atkInfo);
                    animator.SetBool(TransitionParameter.EnergyTaken.ToString(), true);
                }
                else
                {
                    stateEffect.CharacterControl.CharacterData.SendMessage(MessageType.EnergyNotEnough);
                }
            }

            //ProjectileSpawnPoint = stateEffect.CharacterControl.GetProjectileSpawnPoint();

            /*
             * if(stateEffect.CharacterControl.CharacterData.GetPrevState() == Animator.StringToHash("AttackHold"))
             * {
             *  Debug.Log("prev state is attack hold");
             *
             * }
             */
            //Debug.Log ("enter launch projectile: " + stateInfo.normalizedTime.ToString ());
        }
Exemple #2
0
        private void ReflectProjectile(AttackInfo info, Vector3 pos, Vector3 dir)
        {
            GameObject obj            = PoolManager.Instance.GetObject(PoolObjectType.AttackInfo);
            AttackInfo reflectionInfo = obj.GetComponent <AttackInfo> ();

            reflectionInfo.Init(null, info.ProjectileSkill, control);
            obj.SetActive(true);
            extraAttackInfo.Add(reflectionInfo);
            //AttackManager.Instance.CurrentAttackInfo.Add(reflectionInfo);
            reflectionInfo.Register();

            /*
             * Vector3 dir = info.Attacker.gameObject.transform.position - control.gameObject.transform.position;
             * dir.y = 0f;
             */
            reflectionInfo.ProjectileSkill.Launch(reflectionInfo, control, pos, dir);
            info.ProjectileObject.Dead();
        }
Exemple #3
0
        public override void OnEnter(StatewithEffect stateEffect, Animator animator, AnimatorStateInfo stateInfo)
        {
            animator.SetBool(TransitionParameter.AttackMelee.ToString(), false);
            stateEffect.CharacterControl.CommandAttack  = false;
            stateEffect.CharacterControl.CommandExecute = false;
            //animator.SetInteger (TransitionParameter.CheckCombo.ToString (), 0);
            GameObject obj     = PoolManager.Instance.GetObject(PoolObjectType.AttackInfo);
            AttackInfo atkInfo = obj.GetComponent <AttackInfo> ();

            atkInfo.Init(this, null, stateEffect.CharacterControl);
            obj.SetActive(true);
            AttackManager.Instance.CurrentAttackInfo.Add(atkInfo);

            /*
             * if (stateEffect.CharacterControl.isPlayerControl)
             *  VirtualInputManager.Instance.ClearAllInputsInBuffer ();
             */


            //stateEffect.CharacterControl.AttackTrigger = true;
            //animator.SetBool (TransitionParameter.ForcedTransition.ToString (), false);
            //Debug.Log ("Enter " + stateInfo.normalizedTime.ToString());
        }