Beispiel #1
0
    // Use this for initialization
    void Start()
    {
        // Get Game Cpntroller reference
        MGC = GameObject.Find("MaxGameController").GetComponent <MaxGameController>();

        // make column (and Apply MGC scale factors)
        Transform clone = (Transform)Instantiate(column, new Vector3(0f, (float)MGC.levels * MGC.TierHeight / 2, 0), Quaternion.identity);

        clone.transform.localScale = Vector3.Scale(clone.transform.localScale, MGC.ColumnScale);

        // make each layer (Apply MCG Scale factors and append to column)
        for (int level = 0; level < MGC.levels; level++)
        {
            for (int i = 0; i < 12; i++)
            {
                if (MGC.data[level, i] == 1) // default segment
                {
                    //Transform clone = (Transform)Instantiate(segment, new Vector3(0, 1, 0), Quaternion.identity);
                    //clone.Rotate(Vector3.up * i * 30);
                    Transform segClone = (Transform)Instantiate(segment, new Vector3(0, level * MGC.TierHeight, 0), Quaternion.Euler(0, (i * 30) + MGC.SegmentBaseRotation, 0));
                    segClone.gameObject.tag       = level.ToString();
                    segClone.transform.localScale = Vector3.Scale(segClone.transform.localScale, MGC.SegmentScale);
                    segClone.transform.parent     = clone.transform;
                }
            }
        }

        // create the ball
        Transform NewBall = (Transform)Instantiate(ball, new Vector3(MGC.BallOffset, (MGC.levels + MGC.BallStartHeightRatio - 1f) * MGC.TierHeight), Quaternion.identity);

        NewBall.transform.localScale = Vector3.Scale(NewBall.transform.localScale, MGC.BallScale);

        // Relay info to Game Controller
        MGC.BallHeight = transform.position.x;
    }
Beispiel #2
0
    // Use this for initialization
    void Start()
    {
        // Get Game Cpntroller reference
        MGC = GameObject.Find("MaxGameController").GetComponent <MaxGameController>();

        // Set camera to top
        transform.position = new Vector3(transform.position.x, MGC.levels, transform.position.z);

        CurrentTier = MGC.CurrentTier;
    }
Beispiel #3
0
 void Awake()
 {
     if (instance)
     {
         Debug.Log("Already a MaxGameController - going to die now .....");
         DestroyImmediate(gameObject);
         return;
     }
     instance = this;
     DontDestroyOnLoad(gameObject);
 }
Beispiel #4
0
    // Use this for initialization
    void Start()
    {
        // Get Game Cpntroller reference
        MGC = GameObject.Find("MaxGameController").GetComponent <MaxGameController>();

        vel = new Vector3(0, 0, 0);
        //establish the top velocity using Newtonian physics
        // Velocity after falling height D with Acceleration G = Root(2 * D * G)
        // maxVel = new Vector3(0, Mathf.Sqrt(2 * ((MGC.BallStartHeightRatio * MGC.TierHeight) - MGC.BallRadius) * MGC.Gravity), 0);
        // BUGGER IT >>> Not working ... will come back to it .....
    }