Example #1
0
    private void addToPickups(Collider other)
    {
        PickupStruct p = other.gameObject.GetComponent <PickupStruct>();

        foreach (PickupStruct pickup in pickUpInv)
        {
            if (pickup != null)
            {
                if (p.col == pickup.col)
                {
                    return;
                }
            }
        }
        if (pickUpInv.Count == 4)
        {
            pickUpInv[0] = null;
            for (int i = 1; i < pickUpInv.Count; i++)
            {
                if (pickUpInv[i] != null)
                {
                    pickUpInv[i - 1] = pickUpInv[i];
                }
            }
        }
        pickUpInv.Add(other.gameObject.GetComponent <PickupStruct>());
    }
Example #2
0
    void TaskOnClick()
    {
        if (player.pickUpInv.Count - 1 >= invSpaceIndex)
        {
            PickupStruct p        = (PickupStruct)player.pickUpInv[invSpaceIndex];
            Material     material = null;

            switch (p.col)
            {
            case PickupStruct.Colors.BLUE:
                playerController.col = StealthAgainstStruct.Colors.BLUE;
                material             = PlayerBlue;
                break;

            case PickupStruct.Colors.RED:
                playerController.col = StealthAgainstStruct.Colors.RED;
                material             = PlayerRed;
                break;

            case PickupStruct.Colors.YELLOW:
                playerController.col = StealthAgainstStruct.Colors.YELLOW;
                material             = PlayerYellow;
                break;

            case PickupStruct.Colors.ORANGE:
                playerController.col = StealthAgainstStruct.Colors.ORANGE;
                material             = PlayerOrange;
                break;
            }

            Renderer playerShader = player.gameObject.GetComponent <Renderer>();
            playerShader.sharedMaterial = material;

            player.pickUpInv.Remove(p);

            Image img = player.colInvs[player.pickUpInv.Count];
            img.material = null;
            Color c = new Color(1, 1, 1, 1);
            img.color = c;
        }
    }
Example #3
0
    // Update is called once per frame
    void LateUpdate()
    {
        Color c = img.color;

        if (player.pickUpInv.Count - 1 >= invSpaceIndex)
        {
            PickupStruct p = (PickupStruct)player.pickUpInv[invSpaceIndex];
            if (p != null)
            {
                c         = new Color(1, 1, 1, 1);
                img.color = c;
                switch (p.col)
                {
                case PickupStruct.Colors.BLUE:
                    img.material = UIBlue;
                    break;

                case PickupStruct.Colors.RED:
                    img.material = UIRed;
                    break;

                case PickupStruct.Colors.YELLOW:
                    img.material = UIYellow;
                    break;

                case PickupStruct.Colors.ORANGE:
                    img.material = UIOrange;
                    break;
                }
            }
            else
            {
                c         = new Color(1, 1, 1, 0);
                img.color = c;
            }
        }
    }