HexaCube.Spawn C# (CSharp) Method

Spawn() public method

public Spawn ( ) : void
return void
    public void Spawn()
    {
        Spawn (Constants.RandomColor());
    }

Same methods

HexaCube::Spawn ( Color newColor ) : void

Usage Example

示例#1
0
    IEnumerator StartupAnimation()
    {
        for (int i = 0; i < NUM_CUBES; i++)
        {
            HexaCube cube = transform.FindChild("startupAnimation/" + i.ToString()).GetComponent <HexaCube>();
            cube.Spawn(Constants.BLACK);
            cube.transform.FindChild("LookRotation").localScale = Vector3.one * 1.3f;
        }
        yield return(new WaitForSeconds(0.5f));

        transform.FindChild("progressBar").gameObject.SetActive(true);
        transform.FindChild("progressBarBG").gameObject.SetActive(true);

        for (int i = NUM_CUBES - 1; i >= 0; i--)
        {
            HexaCube cube = transform.FindChild("startupAnimation/" + i.ToString()).GetComponent <HexaCube>();
            cube.Despawn();
            cube.Spawn(Constants.WHITE);
            yield return(new WaitForSeconds(0.02f));
        }

        yield return(new WaitForSeconds(0.5f));

        transform.FindChild("progressBarBG").gameObject.SetActive(false);
        transform.FindChild("startupAnimation").gameObject.SetActive(false);

        for (int i = 0; i < NUM_CUBES; i++)
        {
            progressCubes[i].gameObject.SetActive(true);
        }
    }