Example #1
0
    private void Start()
    {
        HP             = MaxHP;
        DroneAnimation = GetComponentInChildren <Animation>();
        NavAgent       = GetComponent <NavMeshAgent>();

        CurrentAction = FirstAction;
        CurrentAction.EnterAction();
    }
Example #2
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown("up"))
        {
            droneAction = moveUp;
        }
        if (Input.GetKeyDown("down"))
        {
            droneAction = moveDown;
        }
        if (Input.GetKeyDown("left"))
        {
            droneAction = moveLeft;
        }
        if (Input.GetKeyDown("right"))
        {
            droneAction = moveRight;
        }
        if (Input.GetKeyDown("space"))
        {
            droneAction = drop;
        }
        if (Input.GetKeyDown("return"))
        {
            droneAction = stopMovement;
        }
        if (Input.GetKeyDown("s"))
        {
            if (isRunning)
            {
                droneAction = startEngine;
            }
            else
            {
                droneAction = startEngine;
            }
        }

        if (droneAction != null)
        {
            droneAction();
        }
    }
Example #3
0
 private void Start()
 {
     droneAction   = drone.GetComponent <DroneAction>();
     virtualAction = drone.GetComponent <VirtualAction>();
 }
Example #4
0
 void OnVoiceCommand(string command)
 {
     droneAction = ConvertVoiceCommandToAction(command);
 }
Example #5
0
 public void ChangeAction(DroneAction newAction)
 {
     CurrentAction.ExitAction();
     CurrentAction = newAction;
     CurrentAction.EnterAction();
 }
Example #6
0
 private void OnEnable()
 {
     HP            = MaxHP;
     CurrentAction = FirstAction;
     CurrentAction.EnterAction();
 }
Example #7
0
 // Start is called before the first frame update
 void Start()
 {
     droneAction = GetComponent <DroneAction>();
 }