private void OnTriggerEnter2D(Collider2D collision) { ObjectDamage = collision.gameObject.GetComponent <DamageSystrm>(); if (ObjectDamage != null) { ObjectDamage.Damage(Damage); Destroy(gameObject); } }
// Use this for initialization void Start() { Manager = FindObjectOfType <AIMoveDecision>(); PlaneManager = FindObjectOfType <PlaneAIDecision>(); Resume.enabled = false; PlaneManager.enabled = false; Manager.enabled = false; PlayerScript = FindObjectOfType <PlayerMovement>(); PlayerScript.enabled = false; Clampers = GameObject.FindGameObjectWithTag("Container"); Player = PlayerScript.gameObject; PlayerDamage = Player.GetComponent <DamageSystrm>(); BGMSource = GetComponent <AudioSource>(); BGMSource.Stop(); Started = false; Clampers.SetActive(false); PlayerScript.Health.SetActive(false); TimeScore = gameObject.transform.Find("HighScore").transform.GetChild(0).GetComponent <Text>(); DontDestroyOnLoad(TimeScore); }