Ejemplo n.º 1
0
    // Update is called once per frame
    void Startimus()
    {
        currentSheepPos = grid.ClosestTile(this);

        if (grid.SheepSearching(this) == false)
        {
            currentSheepPos = grid.ClosestTile(this);
            newPos          = grid.ClosestGrass(this);
        }
        else
        {
            newPos = new Vector2(Random.Range(0, 20), Random.Range(0, 20));
        }
        if (grid.grassTaken(newPos, this) == false)
        {
            currentSheepPos = grid.ClosestTile(this);
            oldPos          = currentSheepPos;
            currentSheepPos = newPos;
        }
        else
        {
            currentSheepPos = grid.ClosestTile(this);
            newPos          = new Vector2(Random.Range(0, 20), Random.Range(0, 20));
            oldPos          = currentSheepPos;
            currentSheepPos = newPos;
        }
        sheepStates = _states.moving;
        run         = false;
    }