Ejemplo n.º 1
0
    public void OnRoomsRotated()
    {
        m_EventCallCount++;

        if (m_EventCallCount < Rooms.Length - 1) //We're rotating only three of them
        {
            return;
        }

        for (int i = 0; i < Rooms.Length; ++i)
        {
            if (Rooms[i].m_ColorIndex != 3)
            {
                return;
            }
        }

        for (int i = 0; i < Rooms[ExitRoomIndex].Walls.Length; ++i)
        {
            GameObject Wall = Rooms[ExitRoomIndex].Walls[i];
            Vector3    bias = Rooms[ExitRoomIndex].transform.position + (Exit.position - Rooms[ExitRoomIndex].transform.position).normalized;

            if (GameUtilities.IsPositionBetweenAB(bias, Exit.position, Wall.transform.position))
            {
                Wall.GetComponent <BoxCollider>().enabled = false;
                StartCoroutine(GameUtilities.DissolveMesh(Wall.GetComponent <Renderer>(), true, 0.75f));
                AudioMgr.PlaySound(Core.instance.BuiltInResources.SolvedPuzzleClip);
                break;
            }
        }

        m_EventCallCount = 0;
    }
Ejemplo n.º 2
0
    IEnumerator DestroyAndRespawn(GameObject obj)
    {
        yield return(GameUtilities.DissolveMesh(obj.GetComponent <Renderer>(), true, 0.75f));

        obj.transform.position = RespawnPoint.position;
        yield return(GameUtilities.DissolveMesh(obj.GetComponent <Renderer>(), false, 0.75f));
    }
Ejemplo n.º 3
0
    IEnumerator Collect()
    {
        GetComponent <Animator>().enabled = false;

        if (ClipToPlayOnCollect != null)
        {
            AudioMgr.PlaySound(ClipToPlayOnCollect);
        }

        Renderer[] rends = GetComponentsInChildren <Renderer>();

        for (int i = 0; i < rends.Length; ++i)
        {
            StartCoroutine(GameUtilities.DissolveMesh(rends[i], true, 0.75f));
        }

        while (rends[rends.Length - 1].material.GetFloat("_Amount") < 1.0f)
        {
            yield return(null);
        }

        LevelMgr.instance.IncrementStateValue(StateToIncrement);
        Destroy(gameObject);
    }