void Increment(int amount, bool sound = true) { m_icoSegment.heightLevel += amount; m_baseDistance += amount * (m_icoPlanet.heightDelta * m_icoPlanet.transform.localScale.x); m_icoSegment.UpdateSegment(); m_icoSegment.UpdateNeighbours(); if (sound && m_oldHeight != m_icoSegment.heightLevel) { if (m_icoSegment.heightLevel <= 0) { AkSoundEngine.PostEvent("Water_Play", gameObject); } else if (amount > 0) { AkSoundEngine.PostEvent("Stone_Up_Play", gameObject); } else if (amount < 0) { AkSoundEngine.PostEvent("Stone_Down_Play", gameObject); } AkSoundEngine.PostEvent("Play_Terra", gameObject); } m_oldHeight = m_icoSegment.heightLevel; }
void TerraformDown(bool state) { if (state) { RaycastHit hit; if (Physics.Raycast(transform.position, transform.forward, out hit, 1000f, LayerMask.GetMask("Planet"))) { IcoSegment segment = hit.collider.gameObject.GetComponent <IcoSegment>(); if (segment) { --segment.heightLevel; segment.UpdateSegment(); segment.UpdateNeighbours(); } } } }