Esempio n. 1
0
    public void SetColor(eColor newColor, ColoredPlatform platform)
    {
        if (!m_Unlocked)
            newColor = eColor.Black;

        int ind = 0;
        for (ind = 0; ind < PlatformColor.eColorList.Length && PlatformColor.eColorList[ind] != newColor; ++ind);
        int mind = 0;
        for (mind = 0; mind < PlatformColor.eColorList.Length && PlatformColor.eColorList[mind] != m_Color; ++mind);

        int mask = LayerMask.NameToLayer(PlatformColor.NameList[ind]);

        platform.SetColor (PlatformColor.ColorList[ind]);
        platform.transform.name = PlatformColor.NameList[ind];

        Queue<Transform> children = new Queue<Transform>();
        children.Enqueue(platform.transform);

        while (children.Count > 0)
        {
            Transform t = children.Dequeue ();
            t.gameObject.layer = mask;
            foreach (Transform child in t)
                children.Enqueue (child);
        }
    }
Esempio n. 2
0
    private bool IsPlayerIgnoredByPlatform(Collider2D platformCollider)
    {
        ColoredPlatform coloredPlatform =
            platformCollider.gameObject.GetComponent <ColoredPlatform>();
        Collider2D playerCollider = GetComponent <Collider2D>();

        if (coloredPlatform.ignored[0] == playerCollider ||
            coloredPlatform.ignored[1] == playerCollider)
        {
            return(true);
        }
        else
        {
            return(false);
        }
    }