private Color GetColorForCondition(BreakTimerManager.Condition _condition) { Color color = new Color(); switch (_condition) { case BreakTimerManager.Condition.Intact: color = Intact; break; case BreakTimerManager.Condition.Minor: color = Minor; break; case BreakTimerManager.Condition.Severe: color = Severe; break; case BreakTimerManager.Condition.Broke: color = Broken; break; } return(color); }
public void UpdateColorForLight(string _key, BreakTimerManager.Condition _condition) { BreakDragonApart(_key, _condition); switch (_key) { case BreakingPoints.Rotate_Left: RollLeftLight.material.color = GetColorForCondition(_condition); break; case BreakingPoints.Rotate_Right: RollRightLight.material.color = GetColorForCondition(_condition); break; case BreakingPoints.Turn_Left: YawLeftLight.material.color = GetColorForCondition(_condition); break; case BreakingPoints.Turn_Right: YawRightLight.material.color = GetColorForCondition(_condition); break; case BreakingPoints.Turn_Up: PitchLight.material.color = GetColorForCondition(_condition); break; case BreakingPoints.Shoot_Fire: BreathLight.material.color = GetColorForCondition(_condition); break; case BreakingPoints.Drop_Oil: OilLight.material.color = GetColorForCondition(_condition); break; case BreakingPoints.Speed_Adjust: GasLight.material.color = GetColorForCondition(_condition); break; } }
private void BreakDragonApart(string _key, BreakTimerManager.Condition _condition) { Debug.LogWarning("Key: " + _key + "\nCondition: " + _condition); List <GameObject> _breakables = m_breakableObjects[_key]; List <GameObject> _spawnables = m_spawnableObjects[_key]; Debug.LogWarning("Breakables count: " + _breakables.Count); Debug.LogWarning("Spawnables count: " + _spawnables.Count); int _amountToBreak = 0; int _amountToSpawn = 0; switch (_condition) { case BreakTimerManager.Condition.Minor: _amountToBreak = 1; _amountToSpawn = 1; break; case BreakTimerManager.Condition.Severe: _amountToBreak = _breakables.Count / 2; _amountToSpawn = _spawnables.Count / 2; break; case BreakTimerManager.Condition.Broke: _amountToBreak = _breakables.Count; _amountToSpawn = _spawnables.Count; break; } Debug.LogWarning("Amount to break: " + _amountToBreak); Debug.LogWarning("Amount to spawn: " + _amountToSpawn); if (_spawnables.Count > 0) { if (_spawnables.Count == 1) { AudioManager.instance.PlayAudioAt(_breakables[0].transform.position, "RemovePiece"); GameObject _newObject = (GameObject)Instantiate(_spawnables[0], _breakables[0].transform.position, _breakables[0].transform.rotation); _newObject.transform.localScale *= SpawnableScale; _newObject.SetActive(true); m_spawnableObjects[_key].RemoveAt(0); } else { for (int i = 0; i < _amountToSpawn; i++) { AudioManager.instance.PlayAudioAt(_breakables[i].transform.position, "RemovePiece"); GameObject _newObject = (GameObject)Instantiate(_spawnables[0], _breakables[i].transform.position, _breakables[i].transform.rotation); _newObject.transform.localScale *= SpawnableScale; _newObject.SetActive(true); m_spawnableObjects[_key].RemoveAt(0); } } } if (_breakables.Count > 0) { if (_breakables.Count == 1) { _breakables[0].SetActive(false); m_breakableObjects[_key].RemoveAt(0); } else { for (int i = 0; i < _amountToBreak; i++) { _breakables[0].SetActive(false); m_breakableObjects[_key].RemoveAt(0); } } } }