public override void OnEnable() { base.OnEnable(); dismount = new Cooldown(dismountTime); actionJump = character.GetAction<CharacterActionJump>(); if (actionJump == null) { Debug.LogError("CharacterActionLadder requires CharacterActionJump"); } }
public override void OnEnable() { base.OnEnable(); actionJump = character.GetAction <CharacterActionJump>(); if (actionJump == null && dismountJumping) { Debug.LogWarning("CharacterActionJump is required in CharacterActionRope because dismountJumping is true"); } canGrab = new Cooldown(grabAgainCooldown); }
public override void OnEnable() { base.OnEnable(); pushingCD = new Cooldown(pushingStartTime); groundMovement = character.GetAction<CharacterActionGroundMovement>(); if (groundMovement == null) { Debug.LogWarning("CharacterActionGroundMovement is required by CharacterActionPush"); } character.onBeforeMove += OnBeforeMove; }
public override void OnEnable() { base.OnEnable(); dismount = new Cooldown(dismountTime); actionJump = character.GetAction <CharacterActionJump>(); if (actionJump == null) { Debug.LogError("CharacterActionLadder requires CharacterActionJump"); } }
public override void OnEnable() { base.OnEnable(); pushingCD = new Cooldown(pushingStartTime); groundMovement = character.GetAction <CharacterActionGroundMovement>(); if (groundMovement == null) { Debug.LogWarning("CharacterActionGroundMovement is required by CharacterActionPush"); } character.onBeforeMove += OnBeforeMove; }
/// <summary> /// This method precalculate some vars, but those value could change. This need to be refactored. /// Maybe setters are the appropiate method to refactor this. /// </summary> virtual public void Awake() { forceAnimation = null; //Debug.Log("Start new Character: " + gameObject.name); pc2d = GetComponent <PlatformerCollider2D> (); health = GetComponent <Health>(); health.onHurt += OnHurt; body = GetComponent <BoxCollider2D>(); if (fallingCD == null) { fallingCD = new Cooldown(fallingTime); } if (groundCD == null) { groundCD = new Cooldown(groundGraceTime); } //TODO review how hotswapping behave in this case ?! health.onDeath += OnDeath; }
/// <summary> /// This method precalculate some vars, but those value could change. This need to be refactored. /// Maybe setters are the appropiate method to refactor this. /// </summary> virtual public void Awake() { forceAnimation = null; if (health == null) { health = GetComponent <CharacterHealth>(); // TODO review how hotswapping behave in this case ?! health.onHurt += onInjured; health.onDeath += OnDeath; } if (fallingCD == null) { fallingCD = new Cooldown(fallingTime); } if (groundCD == null) { groundCD = new Cooldown(groundGraceTime); } }
public override void OnEnable() { base.OnEnable(); actionJump = character.GetAction<CharacterActionJump>(); canGrab = new Cooldown(grabAgainCooldown); }
public virtual void OnDisable() { fallingCD = null; groundCD = null; UpdateManager.instance.Remove(this); }
/// <summary> /// check missconfiguration and initialization /// </summary> public void Start() { Assert.IsFalse(startingHealth < maxHealth, "(CharacterHealth) startingHealth < maxHealth: " + gameObject.name); Assert.IsFalse(startingLives < maxLives, "(CharacterHealth) startingLives < maxLives: " + gameObject.name); character = GetComponent<Character>(); Assert.IsNotNull(character, "(CharacterHealth) Character is required: " + gameObject.name); Heal(startingHealth); lives = startingLives; invulnerability = new Cooldown(invulnerabilityTimeAfterDamage); invulnerability.onReady += () => { if (onInvulnerabilityEnd != null) { onInvulnerabilityEnd(); } }; invulnerability.onReset += () => { if (onInvulnerabilityStart != null) { onInvulnerabilityStart(); } }; }