private void InitGhosts(List <Ghost> ghostsList) { foreach (Ghost g in ghostsList) { GhostControl gc = new GhostControl(_boardControl.Panel); gc.Init(g); _ghostsDic.Add(g.Id, gc); } }
private void Awake() { if (!File.Exists(Application.dataPath + "/Saves/" + playerCar.name + ".txt")) { replayBtn.SetActive(false); } playerCar.GetComponent <CheckpointManager>().gameOver += GameOver; playerCarCtrl = playerCar.GetComponent <CarUserControl>(); audioSource.Add(playerCar.GetComponent <CarAudio>()); ghostCarCtrl = ghostCar.GetComponent <GhostControl>(); foreach (var carAI in carsAI) { carAI.GetComponent <CheckpointManager>().gameOver += GameOver; carsAICtrl.Add(carAI.GetComponent <CarAIControl>()); audioSource.Add(carAI.GetComponent <CarAudio>()); } }
private void OnTriggerEnter2D(Collider2D collision) { Debug.Log(collision.gameObject.tag); GhostControl temp = collision.GetComponent <GhostControl>(); if (collision.gameObject.CompareTag("Wall")) { bloom = true; m_anim.SetTrigger("bloom"); } else if (temp) { if (!temp.die) { bloom = true; m_anim.SetTrigger("bloom"); collision.GetComponent <DemonHealth>().TakeDamage(damage, attackerID); } } }
// Use this for initialization void Start() { controller = GetComponent <GhostControl>(); anim = GetComponentInChildren <Animator>(); }
void Start() { ghost = GameObject.Find("Ghost"); ghostScript = ghost.GetComponent <GhostControl>(); ghost.SetActive(false); }
void OnCollisionEnter(Collision collision) { if (!collisionEnabled) { return; } string otherTag = collision.gameObject.tag; switch (otherTag) { case "Enemy": EnemyControl ec = collision.gameObject.GetComponent <EnemyControl>(); if (ec) { if (ec.gameObject.name == "SpaceInvader") { SpaceInvaderControl sc = (SpaceInvaderControl)ec; sc.Action(gm); } else if (ec.gameObject.name == "Goomba") { GoombaControl gc = (GoombaControl)ec; gc.Action(gm); } else if (ec.gameObject.name == "Bomb") { BombControl bc = (BombControl)ec; bc.Action(gm); gm.AddStamina(-100); gameObject.SetActive(false); GameObject explosion = Instantiate(Resources.Load("Prefabs/Explosion")) as GameObject; explosion.transform.position = gameObject.transform.position; } else if (ec.gameObject.name == "Ghost") { GhostControl gc = (GhostControl)ec; gc.Action(gm); } else { //se.PlaySE("cry"); //ec.Action(gm); } } break; case "River": if (!isJumping) { //GetComponent<Renderer>().isVisible = false; RiverControl rc = collision.gameObject.GetComponent <RiverControl>(); if (rc) { rc.Action(gm); } gameObject.SetActive(false); GameObject splash = Instantiate(Resources.Load("Prefabs/Splash")) as GameObject; splash.transform.position = gameObject.transform.position; } break; case "Collectible": CollectibleControl cc = collision.gameObject.GetComponent <CollectibleControl>(); if (cc.gameObject.name == "Cherry") { gm.MakeGhostsVulnerable(); //CherryControl cherry = (CherryControl)cc; //cherry.Action(gm); cc.Action(gm); } else { cc.Action(gm); } break; } }