// Start is called before the first frame update
 void Awake()
 {
     sphereManager = GameObject.Find("SphereManager").GetComponent <SphereProperties>();
     countdownText = GetComponent <Text>();
     level         = 1;
     resetTimer();
     levelText.text = level.ToString("0");
 }
    /// <inheritdoc/>
    public void Duplicate(ObjectProperties objectProperties)
    {
        SphereProperties cubeProperties = (SphereProperties)objectProperties;

        this.color = cubeProperties.color;

        SphereUI cui = FindObjectOfType(typeof(SphereUI)) as SphereUI;

        cui.Setup(gameObject, this.color);
    }
Beispiel #3
0
    public void onChange(Dropdown dp)
    {
        GameObject obj     = Camera.main.GetComponent <Inspector>().selectedItem;
        int        current = dp.value;

        switch (current)
        {
        case 0:
            obj.transform.GetChild(0).gameObject.GetComponent <Renderer>().material = red;
            break;

        case 1:
            obj.transform.GetChild(0).gameObject.GetComponent <Renderer>().material = green;
            break;

        case 2:
            obj.transform.GetChild(0).gameObject.GetComponent <Renderer>().material = blue;
            break;

        case 3:
            obj.transform.GetChild(0).gameObject.GetComponent <Renderer>().material = purple;
            break;

        case 4:
            obj.transform.GetChild(0).gameObject.GetComponent <Renderer>().material = white;
            break;

        case 5:
            obj.transform.GetChild(0).gameObject.GetComponent <Renderer>().material = black;
            break;

        case 6:
            obj.transform.GetChild(0).gameObject.GetComponent <Renderer>().material = orange;
            break;

        case 7:
            obj.transform.GetChild(0).gameObject.GetComponent <Renderer>().material = yellow;
            break;
        }

        SphereProperties cp = obj.GetComponent <SphereProperties>();

        cp.color = current;
    }
Beispiel #4
0
    // Update is called once per frame
    void Update()
    {
        currentTime       -= 1 * Time.deltaTime;
        countdownText.text = currentTime.ToString("0");

        if (currentTime < 11)
        {
            countdownText.gameObject.GetComponent <Animator>().SetBool("IsBelow10", true);
        }
        if (currentTime < 5)
        {
            countdownText.gameObject.GetComponent <Animator>().SetBool("IsBelow5", true);
        }

        if (currentTime <= 0)
        {
            currentTime = 0;
            if (!loadFinished)
            {
                StartCoroutine(TimeOver());
            }
        }

        if (sphereManager.matchSimilarityNum >= 4)
        {
            if (!loadFinished)
            {
                Debug.Log("Loading Success...");
                StartCoroutine(Success());
            }
        }

        if (sphereManager == null)
        {
            sphereManager = GameObject.FindGameObjectWithTag("SphereManager").GetComponent <SphereProperties>();
        }
    }