Beispiel #1
0
    public void BeginMovement()
    {
        if (moveToggle)
        {
            ray = Camera.main.ScreenPointToRay(Input.mousePosition);
            RaycastHit hit;
            if (Physics.Raycast(ray, out hit, 100))
            {
                if (hit.collider.tag == "UI")
                {
                    hit = new RaycastHit();
                }
                else
                {
                    if (_currentPath == null)
                    {
                        return;
                    }

                    if (_characterStatus.CanMove(_currentPath.Count - 1, _costToMove))
                    {
                        _nextTile = _map.TileCoordToWorldCoord(_currentPath[0].x, _currentPath[0].z);
                        //set their origin tile to be walkable
                        CmdSetTileWalkable(this.tileX, this.tileZ, true);
                        MoveToNextTile();
                        _isMoving = true;

                        CmdSynchAnimations(abil, _isMoving, react, dead);
                    }
                }
            }
        }
    }