void OnTriggerEnter2D(Collider2D other) { if (!isFlagUp) { GetComponent <Animator>().SetTrigger(Animator.StringToHash("flaggUp")); GameObject go = GameObject.FindGameObjectWithTag("GameController"); IMasterOfGame mog = go.GetComponent <MasterOfGame>(); if (mog == null) { mog = go.GetComponent <MasterOfGameAI>(); } mog.EndOfGame(); isFlagUp = true; } }
void Awake() { GameObject mog = GameObject.FindGameObjectWithTag("GameController"); if (mog != null) { mOG = mog.GetComponent <MasterOfGame>(); if (mOG == null) { mOG = mog.GetComponent <MasterOfGameAI>(); } } else { StartCoroutine(Destroy(0)); } }