using System;
using UnityEngine;
namespace Framework.Actors.Platformer {
/// Move that can be performed by a platformer actor
public class PlatformerMove : Move {
/// Called once when the movement is assigned to an actor
/// Actor the movement has been assigned to
protected override void Awake(ActorController actor) {
base.Awake(actor);
this.actorController = actor as PlatformerActorController;
if(this.actorController == null) {
Debug.LogError(
"PlatformerMove or derived class was selected as into an actor controller " +
"that is not a platformer actor controller. PlatformerMoves will only work " +
"with the respective controller type."
);
return;
}
this.actorPresenter = this.actorController.Presenter;
this.actorPhysics = this.actorController.ActorPhysics;
this.rigidBody = this.actorController.Rigidbody;
}
/// Actor controller of the platformer actor the move is selected into
protected PlatformerActorController ActorController {
get { return this.actorController; }
}
/// Actor presenter of the platformer actor
protected PlatformerActorPresenter ActorPresenter {
get { return this.actorPresenter; }
}
/// Rigid body if the actor uses the rigidbody component
///
/// Can be null if rigid body physics are not used.
///
protected Rigidbody Rigidbody {
get { return this.rigidBody; }
}
/// Actor physics if the actor uses the ActorPhysics component
///
/// Can be null if the ActorPhysics component is not used.
///
protected ActorPhysics ActorPhysics {
get { return this.actorPhysics; }
}
/// Actor controller used for the platformer actor
private PlatformerActorController actorController;
/// Actor presenter used for the platformer actor
private PlatformerActorPresenter actorPresenter;
/// Manages movement, momentum and collisions of the actor
private ActorPhysics actorPhysics;
/// Rigidbody to simulate the actor's movement via a physics engine
private Rigidbody rigidBody;
}
} // namespace Framework.Actors.Platformer