Ejemplo n.º 1
0
    private void MoveRobot()
    {
        if (hasStopped || !canStart)
        {
            return;
        }

        movement.Move(MakeMoveDecision());
        AfterMove();
    }
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.W))
        {
            _movement.Move(Move.Up);
        }

        if (Input.GetKeyDown(KeyCode.S))
        {
            _movement.Move(Move.Down);
        }

        if (Input.GetKeyDown(KeyCode.D))
        {
            _movement.Move(Move.Right);
        }

        if (Input.GetKeyDown(KeyCode.A))
        {
            _movement.Move(Move.Left);
        }
    }
Ejemplo n.º 3
0
 /// <summary>
 /// Wandering this robot instance.
 /// </summary>
 void Wandering()
 {
     // First we generate coordinates for our robot to move towards
     if (_finishedMovingWander)
     {
         Vector3 nextCoords = _gm.SpawnFromTheCenter();
         _currentPositionWander = new Vector3(nextCoords.x, transform.position.y, nextCoords.z);
         _finishedMovingWander  = false;
     }
     _rm.Move(_currentPositionWander);
     _finishedMovingWander |= _rm.IsHeNearInstance(_currentPositionWander);
 }