Пример #1
0
    void Start()
    {
        renderer = GetComponent<SpriteRenderer>();


        _state = GetComponent<VillagerState>();
        _actions = GetComponent<VillagerActions>();
        _inventory = GetComponent<VillagerInventory>();
        _storeRef =  transform.parent.gameObject.transform.parent.gameObject.GetComponent<VillageGenerator>().StoreHouse.GetComponent<storeManagement>();
        currentState = executionState.Free;
        if (_state.workplace == null)
            _state.workplace = transform.parent.gameObject.transform.parent.gameObject.GetComponent<VillageGenerator>().Crop;
        _workplace = _state.workplace.transform.position;
        if (_state.wareHouse == null)
            _state.wareHouse = transform.parent.gameObject.transform.parent.gameObject.GetComponent<VillageGenerator>().Warehouse;
        _warehouse = _state.wareHouse.transform.position;
        currentWorkingState = workingState.standby;
        _dangerTimer = 0;
    }
Пример #2
0
    void Start()
    {
        _hunger = startingHunger;
        _thirst = startingThirst;
        _happiness = startingHappiness;
        _sickness = startingSickness;
        _fear = startingSickness;
        GameObject gameController = GameObject.FindGameObjectWithTag("GameController");
        VillagerStatsDecaying decayingComponent= gameController.GetComponent<VillagerStatsDecaying>();
        _maxHungerTime = decayingComponent.hungerDecayingTime;
        _maxThirstTime = decayingComponent.thirstDecayingTime;
        _maxHappinessTime = decayingComponent.happinessDecayingTime;
        _maxSicknessTime = decayingComponent.sicknessDecayingTime;
        _maxFearTime = decayingComponent.fearDecayingTime;
        _resetImmunityTimer = decayingComponent.immunityTime;
        _actionsRef = GetComponent<VillagerActions>();
        _immunityHungerTimer=0f;
    _immunitySicknessTimer=0f;
   _immunityThirstTimer=0f;
     _immunityFearTimer=0f;
     _immunityHappinessTimer=0f;
}