示例#1
0
 // Start is called before the first frame update
 private void Start()
 {
     dinoJump     = GetComponent <DinoJump>();
     dinoMovement = GetComponent <DinoMovement>();
     boxCollider2 = GetComponent <CapsuleCollider2D>();
     animator     = GetComponent <Animator>();
 }
示例#2
0
    private void OnTriggerExit2D(Collider2D collision)
    {
        DinoMovement dino = collision.GetComponent <DinoMovement>();

        if (dino != null)
        {
            Instantiate(platform, new Vector3(platform.transform.position.x + modifier,
                                              platform.transform.position.y, platform.transform.position.z + 1), Quaternion.identity);
            Destroy(transform.parent.gameObject);
        }
    }
示例#3
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        DinoMovement Dino = collision.GetComponent <DinoMovement>();

        if (Dino != null)
        {
            Rigidbody2D rb2d = Dino.GetComponent <Rigidbody2D>();
            cinemachine.enabled = false;
            Dino.enabled        = false;
            rb2d.Sleep();
            gameOverText.enabled = true;
        }
    }
示例#4
0
 //Uses dino data to spawn dinos
 void SpawnDinos()
 {
     if (pars.Length > stageData.spawnLocations.Length)
     {
         Debug.LogError(TAG + "Fewer spawn locations than dinos");
     }
     for (int i = 0; i < pars.Length; i++)
     {
         GameObject newdino = Instantiate(dinofab);                //spawn dino
         newdino.transform.position = stageData.spawnLocations[i]; //set dino to spawn location
         DinoMovement dm = pars[i].AttachAI(this, newdino);        //attaches dino movement script to newly-spawned dude
         dm.playerid = i;                                          //assign player id
         dm.name     = "Dino " + i.ToString();                     //for debugging
         dm.SetOverride(pars[i].data.animator);                    //assign animator override
         dm.SetManager(mgmt);
     }
 }