Beispiel #1
0
 public override bool Activate()
 {
     if (AgentComponent.ActivateAgentSkill(this))
     {
         AgentComponent.AttackerComponent.AttackDamage = AttackDamage;
         m_isActive = true;
         AgentComponent.SetVelocity(0, -Speed);
         return(true);
     }
     return(false);
 }
Beispiel #2
0
        /// <summary>
        /// Deactivate the skill and stop the player during the skill executation
        /// or when the skill is done executing.
        /// </summary>
        public override bool Cancel()
        {
            // Prevent accidental shrinking beyond the original size
            if (m_originalScale != transform.localScale)
            {
                AgentComponent.Invicible = false;

                m_isActive = false;
                AgentComponent.SetVelocity(0f, 0f);
                AgentComponent.AttackerComponent.AttackDamage = AgentComponent.AttackerComponent.DefaultAttackDamage;
                transform.localScale /= Size;
                m_rigidbody2D.mass    = m_originalMass;
            }

            return(AgentComponent.DeactivateAgentSkill(this));
        }
Beispiel #3
0
        /// <summary>
        /// Update physic movement in the titan form.
        /// </summary>
        private void FixedUpdate()
        {
            if (m_isActive)
            {
                switch (AgentComponent.Facing)
                {
                case Direction.Left:
                    AgentComponent.SetVelocity(-Speed, m_rigidbody2D.velocity.y);
                    break;

                case Direction.Right:
                    AgentComponent.SetVelocity(Speed, m_rigidbody2D.velocity.y);
                    break;

                default:
                    break;
                }
            }
        }
Beispiel #4
0
        public override bool Cancel()
        {
            if (m_isActive)
            {
                bool result = AgentComponent.DeactivateAgentSkill(this);
                if (result == true)
                {
                    m_isActive = false;
                    AgentComponent.AttackerComponent.AttackDamage = AgentComponent.AttackerComponent.DefaultAttackDamage;

                    // Set velocity to 0 to reduce the chances of cube
                    // falling through the ground or platforms
                    AgentComponent.SetVelocity(0f, 0f);

                    // Play the stomp audio
                    m_audioSource.clip = StompAudio;
                    m_audioSource.Play();
                }

                return(result);
            }
            return(false);
        }