Exemplo n.º 1
0
 public static bool  CheckCell(PlayGrid grid, Vector2Int pos, List <Vector2Int> closeList)
 {
     if (grid.CheckIsInGrid(pos) && !closeList.Contains(pos))
     {
         return(true);
     }
     return(false);
 }
Exemplo n.º 2
0
        private void FixedUpdate()
        {
            Vector2Int pos = new Vector2Int(Mathf.FloorToInt(transform.position.x), Mathf.FloorToInt(transform.position.z));

            if (grid.CheckIsInGrid(pos))
            {
                _rigidbody.AddForce(grid.GetCell(pos).FlowFieldOrientation *Acceleration);
            }
            _rigidbody.velocity = Vector3.ClampMagnitude(_rigidbody.velocity, MaxSpeed);
        }
Exemplo n.º 3
0
 private void Update()
 {
     if (Move)
     {
         Vector2Int posOnGrid = new Vector2Int(Mathf.FloorToInt(transform.position.x),
                                               Mathf.FloorToInt(transform.position.z));
         if (Grid.CheckIsInGrid(posOnGrid))
         {
             Rigidbody.AddForce(Grid.GetCell(posOnGrid).FlowFieldOrientation);
         }
     }
     Rigidbody.velocity = Vector3.ClampMagnitude(Rigidbody.velocity, MaxSpeed);
 }