public void TimeTick() { //UnityEngine.Debug.Log ("OCPhysiologicalModel::TimeTick!"); UpdateBasicFactors(); UpdateFitness(); UpdateEnergy(); _modeCounts[(int)_currentMode]++; if (_currentMode != AvatarMode.SLEEP) { _currentMode = AvatarMode.IDLE; } foreach (string factor in _basicFactorMap.Keys) { _factorSummaryMap[factor] = _basicFactorMap[factor].value; } _factorSummaryMap["energy"] = _energy; _factorSummaryMap["fitness"] = _fitness; if (_connector != null) { //UnityEngine.Debug.Log ("OCPhysiologicalModel::TimeTick: _connector != null, yaay!!"); // Send updated values to OAC // _connector.SendMessage("sendAvatarSignalsAndTick", _factorSummaryMap); _connector.SendAvatarSignalsAndTick(_factorSummaryMap); // Also update values holding by OCConnector, which would be displayed // in psi panel in unity _connector.SetDemandValue("Energy", (float)_energy); _connector.SetDemandValue("Integrity", (float)_fitness); } }
//--------------------------------------------------------------------------- #endregion #region Public Member Functions //--------------------------------------------------------------------------- void Awake() { _config = OCConfig.Instance; // Initialize parameters below. _modeCounts = new int[3]; _modeCounts[(int)AvatarMode.IDLE] = 0; _modeCounts[(int)AvatarMode.SLEEP] = 0; _modeCounts[(int)AvatarMode.ACTIVE] = 0; _millisecondsPerTick = _config.getLong("MILLISECONDS_PER_TICK"); this.IDLE_ENERGY_DECREASE_RATE = -_millisecondsPerTick / (MILLISECONDS_PER_DAY / _config.getInt("EAT_STOPS_PER_DAY")); this.SLEEP_ENERGY_INCREASE_RATE = -IDLE_ENERGY_DECREASE_RATE * 5; this.STARVING_ENERGY_DECREASE_RATE = IDLE_ENERGY_DECREASE_RATE * 2; this.FITNESS_DECREASE_OUTSIDE_HOME = _config.getFloat("FITNESS_DECREASE_OUTSIDE_HOME"); this.EAT_ENERGY_INCREASE = _config.getFloat("EAT_ENERGY_INCREASE"); this.EAT_POO_INCREASE = _config.getFloat("EAT_POO_INCREASE"); this.DRINK_THIRST_DECREASE = _config.getFloat("EAT_THIRST_DECREASE"); this.DRINK_PEE_INCREASE = _config.getFloat("DRINK_PEE_INCREASE"); _energy = _config.getFloat("INIT_ENERGY"); _fitness = _config.getFloat("INIT_FITNESS"); _currentMode = AvatarMode.IDLE; // this.AT_HOME_DISTANCE = config.getFloat("AT_HOME_DISTANCE"); // this.FITNESS_INCREASE_AT_HOME = config.getFloat("FITNESS_INCREASE_AT_HOME"); // this.at_home_flag = false; SetupBasicFactors(); _connector = OCConnectorSingleton.Instance; }
public void TimeTick() { //UnityEngine.Debug.Log ("OCPhysiologicalModel::TimeTick!"); UpdateBasicFactors(); UpdateFitness(); UpdateEnergy(); _modeCounts[(int)_currentMode]++; if(_currentMode != AvatarMode.SLEEP) { _currentMode = AvatarMode.IDLE; } foreach(string factor in _basicFactorMap.Keys) { _factorSummaryMap[factor] = _basicFactorMap[factor].value; } _factorSummaryMap["energy"] = _energy; _factorSummaryMap["fitness"] = _fitness; if(_connector != null) { //UnityEngine.Debug.Log ("OCPhysiologicalModel::TimeTick: _connector != null, yaay!!"); // Send updated values to OAC // _connector.SendMessage("sendAvatarSignalsAndTick", _factorSummaryMap); _connector.SendAvatarSignalsAndTick(_factorSummaryMap); // Also update values holding by OCConnector, which would be displayed // in psi panel in unity _connector.SetDemandValue("Energy", (float)_energy); _connector.SetDemandValue("Integrity", (float)_fitness); } }
//--------------------------------------------------------------------------- #endregion #region Public Member Functions //--------------------------------------------------------------------------- void Awake() { _config = OCConfig.Instance; // Initialize parameters below. _modeCounts = new int[3]; _modeCounts[(int)AvatarMode.IDLE] = 0; _modeCounts[(int)AvatarMode.SLEEP] = 0; _modeCounts[(int)AvatarMode.ACTIVE] = 0; _millisecondsPerTick = _config.getLong("MILLISECONDS_PER_TICK"); this.IDLE_ENERGY_DECREASE_RATE = - _millisecondsPerTick / (MILLISECONDS_PER_DAY / _config.getInt("EAT_STOPS_PER_DAY")); this.SLEEP_ENERGY_INCREASE_RATE = - IDLE_ENERGY_DECREASE_RATE * 5; this.STARVING_ENERGY_DECREASE_RATE = IDLE_ENERGY_DECREASE_RATE * 2; this.FITNESS_DECREASE_OUTSIDE_HOME = _config.getFloat("FITNESS_DECREASE_OUTSIDE_HOME"); this.EAT_ENERGY_INCREASE = _config.getFloat("EAT_ENERGY_INCREASE"); this.EAT_POO_INCREASE = _config.getFloat("EAT_POO_INCREASE"); this.DRINK_THIRST_DECREASE = _config.getFloat("EAT_THIRST_DECREASE"); this.DRINK_PEE_INCREASE = _config.getFloat("DRINK_PEE_INCREASE"); _energy = _config.getFloat("INIT_ENERGY"); _fitness = _config.getFloat("INIT_FITNESS"); _currentMode = AvatarMode.IDLE; // this.AT_HOME_DISTANCE = config.getFloat("AT_HOME_DISTANCE"); // this.FITNESS_INCREASE_AT_HOME = config.getFloat("FITNESS_INCREASE_AT_HOME"); // this.at_home_flag = false; SetupBasicFactors(); _connector = OCConnectorSingleton.Instance; }