// Use this for initialization void Start() { m_listBeavers = new List <Beaver> (); m_beaverContainer.transform.position = GameObject.FindGameObjectWithTag("SpawnArea").transform.position; m_currentState = BeaversManagerState.GameStarting; m_timeStateStarted[(int)m_currentState] = Time.time; m_treeManager = GameObject.FindGameObjectWithTag("TreeManager").GetComponent <treeManager>(); }
public void Restart() { m_currentState = BeaversManagerState.GameStarting; m_timeStateStarted[(int)m_currentState] = Time.time; m_beaverCreated = 0; m_beaverKilledTotal = 0; if (m_listBeavers!=null) { foreach (Beaver b in m_listBeavers) { GameObject.Destroy (b.gameObject); } m_listBeavers.Clear (); } }
public void Restart() { m_currentState = BeaversManagerState.GameStarting; m_timeStateStarted[(int)m_currentState] = Time.time; m_beaverCreated = 0; m_beaverKilledTotal = 0; if (m_listBeavers != null) { foreach (Beaver b in m_listBeavers) { GameObject.Destroy(b.gameObject); } m_listBeavers.Clear(); } }
// Update is called once per frame void Update() { if (m_beaverCreated - m_beaverKilledTotal >= 50) { m_currentState = BeaversManagerState.LettingPlayerCutDowntree; return; } if (m_currentState == BeaversManagerState.GameStarting) { if (Time.time - m_timeStateStarted [(int)m_currentState] > m_timeToStayInState [(int)m_currentState]) { int cur = (int)m_currentState; cur++; m_currentState = (BeaversManagerState)cur; m_timeStateStarted[(int)m_currentState] = Time.time; return; } } if (Time.time - m_lastCreated >= 1 / m_frequenceCreationBeaver[(int)m_currentState]) { CreateBeaver(); m_lastCreated = Time.time; } //Change State lorsque temps écoulé if (Time.time - m_timeStateStarted [(int)m_currentState] > m_timeToStayInState [(int)m_currentState]) { int cur = (int)m_currentState; cur = (cur + 1) % 3; if (cur == 0) { cur = 1; } m_currentState = (BeaversManagerState)cur; m_timeStateStarted[(int)m_currentState] = Time.time; } }
public void letThePlayerCuttingDownTree() { m_currentState = BeaversManagerState.LettingPlayerCutDowntree; m_timeStateStarted[1] = Time.time; }
// Update is called once per frame void Update() { if (m_beaverCreated - m_beaverKilledTotal >= 50) { m_currentState = BeaversManagerState.LettingPlayerCutDowntree; return; } if (m_currentState == BeaversManagerState.GameStarting) { if (Time.time - m_timeStateStarted [(int)m_currentState] > m_timeToStayInState [(int)m_currentState]) { int cur = (int)m_currentState; cur++; m_currentState = (BeaversManagerState)cur; m_timeStateStarted[(int)m_currentState] = Time.time; return; } } if(Time.time - m_lastCreated >= 1/m_frequenceCreationBeaver[(int)m_currentState]){ CreateBeaver(); m_lastCreated = Time.time; } //Change State lorsque temps écoulé if (Time.time - m_timeStateStarted [(int)m_currentState] > m_timeToStayInState [(int)m_currentState]) { int cur = (int)m_currentState; cur = (cur+1)%3; if(cur == 0){ cur = 1; } m_currentState = (BeaversManagerState)cur; m_timeStateStarted[(int)m_currentState] = Time.time; } }
// Use this for initialization void Start() { m_listBeavers = new List<Beaver> (); m_beaverContainer.transform.position = GameObject.FindGameObjectWithTag ("SpawnArea").transform.position; m_currentState = BeaversManagerState.GameStarting; m_timeStateStarted[(int)m_currentState] = Time.time; m_treeManager = GameObject.FindGameObjectWithTag ("TreeManager").GetComponent<treeManager>(); }
public void letThePlayerCuttingDownTree() { m_currentState = BeaversManagerState.LettingPlayerCutDowntree; m_timeStateStarted[1] = Time.time; }