using System; using UnityEngine; namespace Framework.Actors.Shooter { /// Move that can be performed by a shooter actor public class ShooterMove : 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 ShooterActorController; if(this.actorController == null) { Debug.LogError( "ShooterMove or derived class was selected as into an actor controller " + "that is not a shooter actor controller. ShooterMoves 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 shooter actor the move is selected into protected ShooterActorController ActorController { get { return this.actorController; } } /// Actor presenter of the shooter actor protected ShooterActorPresenter ActorPresenter { get { return this.actorPresenter; } } /// Rigid body if the actor uses the rigidbody component /// /// Can be null if the rigid body physics is 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 shooter actor private ShooterActorController actorController; /// Actor presenter used for the shooter actor private ShooterActorPresenter 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.Shooter