// Update is called once per frame
    void FixedUpdate()
    {
        Vector2 moveVector = new Vector2();
        Vector2 currentPos = rbody.position;

        // Player-controlled movement
        // Vector2 moveVector = getMovementInput();

        //Game-controlled movement
        if (path != null && path.Count > 0)
        {
            Vector2 destination = IsoToRealConverter.IsometricToRealCoordinates(path[0]);
            Vector2 desiredMove = destination - rbody.position;

            if (desiredMove.magnitude < .05)
            {
                path.RemoveAt(0);
            }
            if (path.Count > 0)
            {
                destination = IsoToRealConverter.IsometricToRealCoordinates(path[0]);
                desiredMove = destination - rbody.position;
                moveVector  = desiredMove.normalized;
            }
        }

        // Render the movement
        Vector2 movement = moveVector * movementSpeed;
        Vector2 newPos   = currentPos + movement * Time.fixedDeltaTime;

        isoRenderer.SetDirection(movement);
        rbody.MovePosition(newPos);
    }
Пример #2
0
 public void PlaceBurger()
 {
     burgerIsoCoordinates      = GenerateLegalIsoCoordinates();
     burger.transform.position = IsoToRealConverter.IsometricToRealCoordinates(burgerIsoCoordinates, 0.0f, -.75f);
     print("Burger at " + burgerIsoCoordinates);
 }
Пример #3
0
 public void FindWitch()
 {
     witchIsoCoordinates = IsoToRealConverter.RealToIsometricCoordinates(witch.transform.position);
 }
Пример #4
0
 public void PlaceWitch()
 {
     witchIsoCoordinates      = GenerateLegalIsoCoordinates();
     witch.transform.position = IsoToRealConverter.IsometricToRealCoordinates(witchIsoCoordinates);
 }