예제 #1
0
        /// <summary>
        /// Performs the cast.
        /// </summary>
        /// <param name="origin">The location that the cast should spawn from.</param>
        /// <param name="direction">The direction of the cast.</param>
        /// <param name="targetPosition">The target position of the cast.</param>
        public override void Cast(Transform origin, Vector3 direction, Vector3 targetPosition)
        {
            if (m_Effect == null)
            {
                return;
            }

            m_CharacterLocomotion.TryStartEffect(m_Effect);
        }
예제 #2
0
        /// <summary>
        /// The object has taken been damaged.
        /// </summary>
        /// <param name="amount">The amount of damage taken.</param>
        /// <param name="position">The position of the damage.</param>
        /// <param name="direction">The direction that the object took damage from.</param>
        /// <param name="forceMagnitude">The magnitude of the force that is applied to the object.</param>
        /// <param name="frames">The number of frames to add the force to.</param>
        /// <param name="radius">The radius of the explosive damage. If 0 then a non-explosive force will be used.</param>
        /// <param name="attacker">The GameObject that did the damage.</param>
        /// <param name="attackerObject">The object that did the damage.</param>
        /// <param name="hitCollider">The Collider that was hit.</param>
        public override void OnDamage(float amount, Vector3 position, Vector3 direction, float forceMagnitude, int frames, float radius, GameObject attacker, object attackerObject, Collider hitCollider)
        {
            base.OnDamage(amount, position, direction, forceMagnitude, frames, radius, attacker, attackerObject, hitCollider);

            if (m_DamagedEffect != null)
            {
                m_CharacterLocomotion.TryStartEffect(m_DamagedEffect);
            }
        }
예제 #3
0
        /// <summary>
        /// The object has taken been damaged.
        /// </summary>
        /// <param name="damageData">The data associated with the damage.</param>
        public override void OnDamage(DamageData damageData)
        {
            base.OnDamage(damageData);

            if (m_DamagedEffect != null)
            {
                m_CharacterLocomotion.TryStartEffect(m_DamagedEffect);
            }
        }
예제 #4
0
        /// <summary>
        /// Tries to start or stop the specified effect.
        /// </summary>
        /// <returns>Success if the effect was started or stopped.</returns>
        public override TaskStatus OnUpdate()
        {
            if (m_Effect == null)
            {
                return(TaskStatus.Failure);
            }

            // The effect is not null - try to start or stop the effect.
            if (m_Start.Value)
            {
                var effectStarted = m_CharacterLocomotion.TryStartEffect(m_Effect);
                return((effectStarted || m_AlwaysReturnSuccess.Value) ? TaskStatus.Success : TaskStatus.Failure);
            }
            else
            {
                var effectStopped = m_CharacterLocomotion.TryStopEffect(m_Effect);
                return((effectStopped || m_AlwaysReturnSuccess.Value) ? TaskStatus.Success : TaskStatus.Failure);
            }
        }
예제 #5
0
 /// <summary>
 /// Tries to start the effect.
 /// </summary>
 /// <returns>True if the effect was successfully started.</param>
 public bool StartEffect()
 {
     return(m_CharacterLocomotion.TryStartEffect(this));
 }