Ejemplo n.º 1
0
        /// <summary>
        /// Actually applies the force to jump.
        /// </summary>
        void JumpImpl()
        {
            // Apply upward force to jump
            Rigidbody.AddForce(Vector3.up * Mathf.Sqrt(2 * Gravity * _jumpHeights[JumpCount]), ForceMode.VelocityChange);

            JumpCount++;

            CharacterEvents.Publish(new PlayerJumpEvent {
                Ground = IsGrounded, RemainingJumps = MaxJumpCount - JumpCount
            });
        }
Ejemplo n.º 2
0
        public void Heal(object source, float healing)
        {
            healing = Mathf.Abs(healing);

            if (HealingModifiers.In.Count > 0)
            {
                healing = HealingModifiers.In.Modifiy(source, healing);
            }

            CurrentDamage = DamageType.Heal(CurrentDamage, healing);

            CharacterEvents.Publish(new PlayerHealEvent {
                Healing = healing, CurrentDamage = CurrentDamage
            });
        }
Ejemplo n.º 3
0
        public void Damage(object source, float damage)
        {
            damage = Mathf.Abs(damage);

            if (DamageModifiers.In.Count > 0)
            {
                damage = DamageModifiers.In.Modifiy(source, damage);
            }

            CurrentDamage = DamageType.Damage(CurrentDamage, damage);

            Mathf.Clamp(CurrentDamage, DamageType.MinDamage, DamageType.MaxDamage);

            CharacterEvents.Publish(new PlayerDamageEvent {
                Damage = damage, CurrentDamage = CurrentDamage
            });
        }