// Start is called before the first frame update
 void Start()
 {
     t  = 0;
     rb = this.gameObject.GetComponentInChildren <Rigidbody2D>();
     this.initialPosition    = this.rb.position;
     this.playerScript       = GameObject.Find("Player").gameObject.GetComponent <PlayerControllerScript>();
     this.plantManagerScript = GameObject.Find("PlantManager").GetComponent <PlantManagerScript>();
     this.direction          = this.playerScript.direction;
     if (this.type != TYPE_VINE)
     {
         this.rb.gravityScale = 1f;
         this.rb.velocity     = new Vector2(this.direction, 0);
     }
 }
Exemple #2
0
 // Start is called before the first frame update
 void Start()
 {
     System.Random r;
     r       = new System.Random();
     songNum = r.Next(0, 3);
     Debug.Log(songNum);
     beepAndBoop             = this.gameObject.GetComponents <AudioSource>();
     lastStarSpot            = this.gameObject.transform.position;
     canMove                 = true;
     grounded                = false;
     future                  = false;
     canShift                = true;
     gigawatts               = false;
     rb                      = this.gameObject.GetComponentInChildren <Rigidbody2D>();
     feet                    = this.gameObject.GetComponentInChildren <FootCheckScript>();
     this.seedExists         = false;
     currentRoom             = 0;
     this.plantManagerScript = GameObject.Find("PlantManager").GetComponent <PlantManagerScript>();
     anim                    = this.gameObject.GetComponentInChildren <Animator>();
     characterSprite         = GameObject.Find("Protaginist_Idle");
     beepAndBoop[0].clip     = songs[songNum];
     beepAndBoop[0].Play();
 }