Exemplo n.º 1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="T:MoveToCommand"/> class.
 /// </summary>
 /// <param name="destinationMover">The IDestinatinMover to act on.</param>
 /// <param name="start">
 /// The world space location of the IDestinationMover before this
 /// MoveToCommand is invoked.
 /// </param>
 /// <param name="destination">
 /// The world space location that the DestinationMover will start to move
 /// towards after this MoveToCommand is invoked.
 /// </param>
 public MoveToCommand(IDestinationMover destinationMover, Vector3 start,
                      Vector3 destination)
 {
     this.start            = start;
     this.destination      = destination;
     this.destinationMover = destinationMover;
 }
    protected void Awake()
    {
        destinationMover = GetComponent <IDestinationMover>();

        if (destinationMover == null)
        {
            Debug.LogError("[" + gameObject.name + " 's EnemyController] " +
                           "has no IDestinationMover Component attached!");
        }
    }
Exemplo n.º 3
0
 /// <summary>
 /// Handles a mouse InputButton being pressed down.
 /// </summary>
 /// <param name="button">
 /// The mouse InputButton that was pressed down.
 /// </param>
 /// <param name="mouseControllable">
 /// The Movable that will react to the mouse InputButton being pressed
 /// down.
 /// </param>
 /// <param name="mousePosition">Mouse position.</param>
 public void HandleMouseButtonDown(InputButton button,
                                   IDestinationMover destinationMover, Vector3 worldSpaceDestination)
 {
     if (button.Equals(leftMouseButton))
     {
         commandProcessor.ProcessCommand(new MoveToCommand(
                                             destinationMover,
                                             destinationMover.Position,
                                             worldSpaceDestination
                                             ));
     }
 }
 private void Awake()
 {
     destinationMover      = GetComponent <IDestinationMover>();
     mousePositionDetector = GetComponent <MousePositionDetector>();
 }