/// <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)) ); }
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) )); }