Example #1
0
        public void PlayerSpellAttack(string SpellID, int _TargetPosition, int UnitAttackingID) // Action onAttackComplete
        {
            CurrentUnitID = UnitAttackingID;

            GameManager.IAUnitCrew.TryGetValue(_TargetPosition, out _IAUnitGameObject);

            Vector3 slideTargetPosition = _IAUnitGameObject.InstantiatedUnit.transform.position + (transform.parent.position - _IAUnitGameObject.InstantiatedUnit.transform.position).normalized * 1f; // Offset
            Vector3 startingPosition    = transform.parent.position;

            // Slide to Target
            SlideToPosition(slideTargetPosition, SpellID, () =>
            {
                // Arrived at Target, attack him
                state             = State.Busy;
                Vector3 attackDir = (_IAUnitGameObject.InstantiatedUnit.transform.position - transform.parent.position).normalized;
                PlayAnimAttack(SpellID, () => {
                    SlideToPosition(startingPosition, SpellID, () => {
                        // Slide back completed, back to idle
                        state = State.Idle;
                        //anim.SetBool(SpellID, false); // "isUnitRunningSpellOne"
                        anim.SetBool("isTransitionToDash", false);
                        Debug.Log("Send Player TurnOverPacket");
                        ClientSend.TurnOverPacket(CurrentUnitID, "PLAYER_TURN_OVER");
                    });
                });
            });
        }
Example #2
0
        public void PlayerSpellBuff(string SpellID, int _TargetPosition, int UnitAttackingID) // Action onAttackComplete
        {
            CurrentUnitID = UnitAttackingID;

            GameManager.IAUnitCrew.TryGetValue(_TargetPosition, out _IAUnitGameObject);

            //Vector3 slideTargetPosition = _IAUnitGameObject.InstantiatedUnit.transform.position + (transform.parent.position - _IAUnitGameObject.InstantiatedUnit.transform.position).normalized * 1f; // Offset
            //Vector3 startingPosition = transform.parent.position;

            PlayAnimAttack(SpellID, () => {
                // Slide back completed, back to idle
                state = State.Idle;
                anim.SetBool(SpellID, false);
                Debug.Log("Send Player TurnOverPacket");
                ClientSend.TurnOverPacket(CurrentUnitID, "PLAYER_TURN_OVER");
            });
        }