DamianItemPickup

using System.Collections; using System.Collections.Generic; using UnityEngine; public class DamianItemPick : MonoBehaviour { public PlayerMovement myOtherScript; public CharacterInfo kieransOtherScript; public Score scoreScript; void Start () { myOtherScript = GameObject.FindWithTag("Player").GetComponent<PlayerMovement>(); kieransOtherScript = GameObject.FindWithTag("Player").GetComponent<CharacterInfo>(); scoreScript = GameObject.FindWithTag("Player").GetComponent<Score>(); } void OnTriggerEnter(Collider other) { if(other.transform.tag == "ShoeItem" && kieransOtherScript.RunShoesOn == false) { myOtherScript.CharSpeed = myOtherScript.CharSpeed*2; kieransOtherScript.RunShoesOn = true; scoreScript.P1Score += 100; Destroy(other.gameObject); print("Got ability from shoes"); } else { Destroy(other.gameObject); print("You had this item"); } } }

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.