void Awake()
    {
        handler = this;

        cubes         = new List <CubeThumper>();
        targetedCubes = new List <CubeThumper>();
    }
Beispiel #2
0
    private IEnumerator EmitCubes()
    {
        while (_gameController.IsRunning)
        {
            int RNG = Random.Range(0, _cubeEmitters.Length);
            _cubeEmitters[RNG].GetComponent <Renderer>().material.color = _emissionColor;
            yield return(_emitterDelay);

            if (_gameController.IsRunning)
            {
                Vector3     position = _cubeEmitters[RNG].transform.position;
                CubeHandler cube     = Instantiate(
                    _cube, position, Quaternion.identity)
                                       .GetComponent <CubeHandler>();

                yield return(null);

                cube.SetDirection(
                    _emitterProperties.GetDirection(position.x),
                    _emitterProperties.GetDirection(position.y));

                _cubeEmitters[RNG].GetComponent <Renderer>().material.color = _defaultColor;
            }
        }
    }
Beispiel #3
0
    // sets up variables including cost and such
    void Start()
    {
        money       = FindObjectOfType <Money>();
        cubeHandler = FindObjectOfType <CubeHandler>();

        cost = (Mathf.RoundToInt(1100 * (Mathf.Pow(1.8f, Level))));

        BuyPet.interactable = false;

        LevelOutput.text = ("Level: " + Level);
        CostOutput.text  = ("$$" + cost.ToString("N0"));
    }
Beispiel #4
0
    private void Start()
    {
        spawnPos = transform.position; //remember the initial position
        spawnRot = transform.rotation;

        if (transform.name == "cubePlayer2")
        {
            spawnPos -= new Vector3(0, 1, 0);
        }

        uicontroller = Terrain.GetComponent <UIController>();
        cubehandler  = Terrain.GetComponent <CubeHandler>();
    }
Beispiel #5
0
    void Start()
    {
        m_cubeHandler = GetComponent <CubeHandler> ();

        m_xNum     = m_cubeHandler.cubeNumber.x;
        m_yNum     = m_cubeHandler.cubeNumber.y;
        m_length   = m_cubeHandler.cubeNumber.x * m_cubeHandler.cubeNumber.y;
        m_indexX   = new NativeArray <float> (m_length, Allocator.Persistent);
        m_indexY   = new NativeArray <float> (m_length, Allocator.Persistent);
        m_position = new NativeArray <Vector3> (m_length, Allocator.Persistent);

        Transform[] transformArray = new Transform[m_length];
        for (int x = 0; x < m_xNum; x++)
        {
            for (int y = 0; y < m_yNum; y++)
            {
                m_indexX[x * m_yNum + y]       = x;
                m_indexY[x * m_yNum + y]       = y;
                m_position[x * m_yNum + y]     = m_cubeHandler.cubeTransform[x, y].localPosition;
                transformArray[x * m_yNum + y] = m_cubeHandler.cubeTransform[x, y];
            }
        }
        m_transformsAccess = new TransformAccessArray(transformArray);
    }
Beispiel #6
0
 void Start()
 {
     m_cubeHandler = GetComponent <CubeHandler> ();
 }