void OnEnable() { m_currentBehaviour = EWindBehaviour.e_behaviour_straigth; m_currentState = EWindState.e_state_starting; currentMvt = 0.0f; nbTrail = 0; nbTrailActivated = 0; currentSpeed = 7.5f; startPos = new Vector3(0.0f, 0.0f, -20); endPos = new Vector3(0.0f, 0.0f, -20); deltaTrail = 0.0f; }
internal void StartStraigth() { // // Random start pos float xPosS = 0.0f; float yPosS = 0.0f; float xPosE = 0.0f; float yPosE = 0.0f; switch (UnityEngine.Random.Range(1, 5)) { case 1: xPosS = minX - 2; yPosS = (float)UnityEngine.Random.Range(-545, 545) / 100.0f; xPosE = maxX + 4; yPosE = (float)UnityEngine.Random.Range(-545, 545) / 100.0f; break; case 2: xPosS = maxX + 2; yPosS = (float)UnityEngine.Random.Range(-545, 545) / 100.0f; xPosE = minX - 4; yPosE = (float)UnityEngine.Random.Range(-545, 545) / 100.0f; break; case 3: xPosS = (float)UnityEngine.Random.Range(-965, 965) / 100.0f; yPosS = minY - 2; xPosE = (float)UnityEngine.Random.Range(-965, 965) / 100.0f; yPosE = maxY + 4; break; case 4: xPosS = (float)UnityEngine.Random.Range(-965, 965) / 100.0f; yPosS = maxY + 2; xPosE = (float)UnityEngine.Random.Range(-965, 965) / 100.0f; yPosE = minY - 4; break; } startPos = new Vector3(xPosS, yPosS, -20); endPos = new Vector3(xPosE, yPosE, -20); transform.position = startPos; m_currentBehaviour = EWindBehaviour.e_behaviour_straigth; m_currentState = EWindState.e_state_moving; currentSpeed = 7.5f; }