Exemple #1
0
    void Awake()
    {
        gm = GameObject.FindGameObjectWithTag("GameManager").GetComponent <GameManagerThing>();


        for (int i = 0; i < targetPositions.Count; i++)
        {
            int randPickUpChance = Random.Range(0, 100);


            GameObject newMailbox   = Instantiate(MailBoxes [0], Vector2.zero, Quaternion.identity) as GameObject;
            Transform  boxTransform = newMailbox.transform;

            if (randPickUpChance >= 65 && gm.collectables <= 2)
            {
                TargetBehaivor targetBehaivor = newMailbox.GetComponent <TargetBehaivor> ();
                targetBehaivor.isPickUp = true;
                boxTransform.GetComponentInChildren <Animator> ().SetTrigger("isPickUp");
            }
            boxTransform.SetParent(targetParent);
            boxTransform.localPosition = targetPositions [i].localPosition;
        }


        groundSpawner = GameObject.FindGameObjectWithTag("GroundSpawner").GetComponent <GroundSpawning>();
        moveSpeed     = groundSpawner.groundMoveSpeedMin;
    }
Exemple #2
0
 void Awake()
 {
     randTime      = Random.Range(minGenTime, maxGenTime);
     groundSpawner = GameObject.FindGameObjectWithTag("GroundSpawner").GetComponent <GroundSpawning>();
 }