public override void Initialization(ActCharacterNew character) { base.Initialization(character); _actJump = character.GetAbility(typeof(ActJump)) as ActJump; _actWallCling = character.GetAbility(typeof(ActWallCling)) as ActWallCling; }
protected virtual void OnTriggerEnter2D(Collider2D collider) { // we check that the object colliding with the ladder is actually a corgi controller and a character ActCharacterNew actChar = collider.GetComponent <ActCharacterNew>(); if (actChar == null || actChar.GetAbility(typeof(ActClimbing)) == null) { return; } ActClimbing actClimbing = actChar.GetAbility(typeof(ActClimbing)) as ActClimbing; actClimbing.LadderColliding = true; actClimbing.CurrentLadder = this; }
/// <summary> /// Triggered when something exits the ladder /// </summary> /// <param name="collider">Something colliding with the ladder.</param> protected virtual void OnTriggerExit2D(Collider2D collider) { // we check that the object colliding with the ladder is actually a corgi controller and a character ActCharacterNew actChar = collider.GetComponent <ActCharacterNew>(); if (actChar == null || actChar.GetAbility(typeof(ActClimbing)) == null) { return; } ActClimbing actClimbing = actChar.GetAbility(typeof(ActClimbing)) as ActClimbing; // when the character is not colliding with the ladder anymore, we reset its various ladder related states actClimbing.LadderColliding = false; actClimbing.CurrentLadder = null; }
public virtual void OnTriggerEnter2D(Collider2D collider) { ActCharacterNew c = collider.gameObject.GetComponent <ActCharacterNew>(); if (c == null) { return; } ActGrip grip = c.GetAbility(typeof(ActGrip)) as ActGrip; if (grip == null) { return; } grip.StartGripping(this); }