ForceJump() public method

Force Character to Jump! User must be sure of what they are doing... this doesn't check anything
public ForceJump ( Jump j ) : void
j Jump
return void
Ejemplo n.º 1
0
        /// <summary>
        /// Force a player to jump!
        /// </summary>
        public virtual void StartJump(Character character)
        {
            CharacterActionJump actionJump = character.GetAction <CharacterActionJump>();

            Assert.IsNotNull(actionJump, "(Jumper) Missing Monobehaviour CharacterActionJump at " + character.gameObject.GetFullName());

            actionJump.ForceJump(
                new JumpConstantSpring(character, jumpProperties.Clone(1))
                );
        }
Ejemplo n.º 2
0
        public virtual void StartJump(Character c)
        {
            // search CharacterActionJump
            CharacterActionJump actionJump = null;

            foreach (var x in c.actions)
            {
                if (x is CharacterActionJump)
                {
                    actionJump = x as CharacterActionJump;
                }
            }

            if (actionJump != null)
            {
                actionJump.ForceJump(
                    new JumpConstantSpring(c, jumpProperties.Clone(1))
                    );
            }
            else
            {
                Debug.LogWarning("character found without CharacterActionJump so ignore.");
            }
        }
 void OnHurtCharacter(Damage dt, CharacterHealth h, Character to)
 {
     actionJump.ForceJump(new JumpConstant(character,
                                           jumpProperties.Clone((int)character.faceDir)
                                           ));
 }