void Start() { //_Player = this.gameObject; SC_BatimentChoiceRef = this.GetComponent <SC_BatimentChoice>(); l_LifeLamp = transform.Find("LifeLamp").light; f_LifeAmountMax = f_LifeAmount; f_LifeLampMax = l_LifeLamp.spotAngle; //v_StartPos = transform.position; v_respawnPoint = GameObject.FindGameObjectWithTag("respawnPoint").transform.position; v_respawnPoint = new Vector3(v_respawnPoint.x, v_respawnPoint.y, transform.position.z); //SC_playerComboCounterRef = this.GetComponent<SC_playerComboCounter>(); SC_ScoreCounterRef = GameObject.FindGameObjectWithTag("scoreCounter").GetComponent <SC_ScoreCounter>(); SC_PlayerRef = this.GetComponent <SC_Player>(); SC_mainLightRef = GameObject.Find("flashLight_root").GetComponent <SC_mainLight>(); _deathColor = SC_PlayerRef.s_Color; }
public void PlaceBatiment(string s_BatimentName, int _Player, SC_BatimentChoice SC_BatimentChoiceRef) { Vector3 _posTemp; int securityLoop = 3000; float _Eloignement = 2.9f; //augment de +1 à chaque fois que float _NbTest = 0; //reduit à chaque test et est reinitialisé avec le nouveau NbAutour float _test = 1; float _NbAutour = Mathf.Round((Mathf.Log10(_test) + 15) * _test); do { _posTemp = new Vector3(transform.position.x + Mathf.Cos(Mathf.Deg2Rad * (360 * _NbTest / _NbAutour)) * _Eloignement * 1.7f, transform.position.y + Mathf.Sin(Mathf.Deg2Rad * (360 * _NbTest / _NbAutour)) * _Eloignement, transform.position.z); _NbTest++; securityLoop--; if (_NbTest > _NbAutour) { _test++; _NbAutour = Mathf.Round((Mathf.Log10(_test) + 13) * _test * 0.6f); _Eloignement = _Eloignement + 1.2f; _NbTest = 0; } }while(IsBatAround(_posTemp) && securityLoop > 0); _BatimentAudioSource.PlayOneShot(_Sounds.GetSound("ChoiceMade")); GameObject _Temp = Instantiate(GetBatBatiment(s_BatimentName), _posTemp, Quaternion.identity) as GameObject; a_BatimentPlaced.Add(_Temp); _Temp.GetComponent <SC_batimentVie>().s_BatType = s_BatimentName; _Temp.GetComponent <SC_batimentVie>().SetPlayer(a_Players[_Player - 1]); SC_BatimentChoiceRef.t_particleDestination = _Temp.transform; }