예제 #1
0
    void Awake()
    {
        masterLogic ml = GameObject.Find("Master").GetComponent <masterLogic>();

        //Initilizing the projectile's behavior and color
        GameObject cs = ml.colorSphere;

        this.GetComponent <Renderer>().material.color = cs.GetComponent <Renderer>().material.color;

        if (this.GetComponent <Renderer>().material.color == Color.red)
        {
            myColor = 1;
        }
        if (this.GetComponent <Renderer>().material.color == Color.yellow)
        {
            myColor = 2;
        }
        if (this.GetComponent <Renderer>().material.color == Color.blue)
        {
            myColor = 3;
        }

        //Apply all the neccesary modifications to Master
        ml.balls -= 1;

        ml.color     = ml.colorNext;
        ml.colorNext = Random.Range(1, 4);
    }
예제 #2
0
    void Awake()
    {
        //Level Generation
        //Gets information from Master after it loads the game information to control how tall the level is.
        masterLogic ml = GameObject.Find("Master").GetComponent <masterLogic>();

        layerAdd = ml.layerAdd;

        float angle = 360f / (float)pieces;

        for (int layers = 1; layers < 16 + layerAdd; layers++)
        {
            float angleOffset = (layers % 2) * 0.5f * angle;
            for (int i = 0; i < pieces; i++)
            {
                Quaternion rotation = Quaternion.AngleAxis(i * angle + angleOffset, Vector3.up);

                Vector3 direction = rotation * Vector3.forward;

                Vector3 position = center + (direction * radius);

                GameObject go = (GameObject)Instantiate(cylinder, position, rotation);
                go.GetComponent <cylinderBehavior>().myLayer = layers;
            }
            center.y += .6f;
        }
    }
예제 #3
0
    void Start()
    {
        Vector3 a = transform.eulerAngles;

        x     = a.y;
        tempX = a.y;
        y     = a.x;

        ml = GameObject.Find("Master").GetComponent <masterLogic>();
    }
예제 #4
0
    private void Start()
    {
        rbody      = GetComponent <Rigidbody>();
        initialPos = transform.position;
        fallen     = false;

        ml = GameObject.Find("Master").GetComponent <masterLogic>();

        if (myLayer <= ml.topLayer - 8)
        {
            rbody.isKinematic = true;
        }
    }