void Start() { gameManager = GameObject.Find("GameManager").GetComponent <GameManager>(); stats = this.GetComponent <ReactorAttributes>(); r = GetComponent <Rigidbody2D>(); currHealth = maxHealth; anim = GetComponent <Animator>(); isInvulnerable = false; }
void OnCollisionEnter2D(Collision2D col) { if (col.transform.CompareTag("Player")) { ReactorAttributes stats = col.transform.GetComponent <ReactorAttributes>(); if (stats["movementSpeed"].GetValue() >= speedRequirement) { breakTile(); } } }
void OnTriggerEnter2D(Collider2D collider) { // if the thing collided with is a player, if (collider.gameObject.name == "Player") { ReactorAttributes player = collider.gameObject.GetComponent <ReactorAttributes>(); // give the player the electricity player.AddElectricity(amountOfElectricity); // play sound AudioSource.PlayClipAtPoint(source, Camera.main.transform.position, 0.50f); // and get rid of this pickupable Destroy(gameObject); } }
void Start() { stats = this.GetComponent <ReactorAttributes>(); playerController = this.GetComponent <PlayerController>(); }
void Start() { // Image component of the bar that shows the user how many points have been allocated fillBar = gameObject.transform.GetChild(0).gameObject.GetComponent <Image>(); stats = player.GetComponent <ReactorAttributes>(); }