Exemple #1
0
    void Die()
    {
        _state        = GrassStates.Dirt;
        _colorCurrent = _colorDirt;

        _isOld          = false;
        _isMature       = false;
        _isTrampledUpon = false;
        _isEatenUpon    = false;
    }
Exemple #2
0
    public Script_Tile(Script_Grid p_grid, GrassStates p_state, int p_gridXCoordinate, int p_y, int p_gridZCoordinate, Quaternion p_rotation)
    {
        _position        = new Vector3Int(p_gridXCoordinate, -1, p_gridZCoordinate);
        _tileObject      = GameObject.CreatePrimitive(PrimitiveType.Cube);
        _tileObject.name = "TileObject";
        _tileObject.transform.position = _position;
        _tileObject.transform.rotation = p_rotation;
        _material       = _tileObject.GetComponent <Renderer>().material;
        _material.color = Color.white;



        _nearbySheep       = new List <Script_Sheep> ();
        _isOccupiedBySheep = false;
        _isOccupiedByWolf  = false;
        _grid            = p_grid;
        _gridXCoordinate = p_gridXCoordinate;
        _gridZCoordinate = p_gridZCoordinate;

        _sheepSensingRange = 2;

        _isOld              = false;
        _actDelegate        = null;
        _matureTimerMax     = 5.0f;
        _matureTimerCurrent = 0.0f;
        _isMature           = false;
        _maxHealth          = 10.0f;
        _state              = p_state;

        _colorDirt          = new Color(1, 1, 0, 1);
        _colorGrass         = new Color(0, 1, 1, 1);
        _colorDecayingGrass = new Color(0.5f, 0.5f, 0, 1);

        _isTrampledUpon = false;
        _isEatenUpon    = false;

        if (_state == GrassStates.Dirt)
        {
            _health       = 0.0f;
            _colorCurrent = _colorDirt;
        }
        else if (_state == GrassStates.Grass)
        {
            _health       = 8.0f;
            _colorCurrent = Color.Lerp(_colorDecayingGrass, _colorGrass, _health / _maxHealth);
        }

        SetColor(_colorCurrent);
    }
Exemple #3
0
 public void SetState(GrassStates p_state)
 {
     _state = p_state;
 }