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;
    }
Пример #2
0
    static bool UpdateFullLoopLeft(IcoSegment segment, int side)
    {
        IcoSegment current  = segment.neighbours[side];
        IcoSegment previous = segment;

        while (current != segment)
        {
            current.UpdateSegment();
            IcoSegment tmp = current;
            current  = current.LeftFrom(previous);
            previous = tmp;
        }
        return(true);
    }
Пример #3
0
 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();
             }
         }
     }
 }