private void OnTriggerEnter2D(Collider2D other) { if (state == DotState.ReadyForClick) { PacmanController pacman = other.GetComponent <PacmanController>(); BeEaten(DotValue); pacman.EatDot(DotValue); if (Effect != DotEffect.Normal) { pacman.SetEffect(Effect); } } }
private void InititalizeGameObjects() { map = new Map(this, level); enemies = map.Enemies; gameEnd = false; pacman = map.Pacman; pacManController = new PacmanController(this, pacman); enemiesController = new EnemiesController(this, map); musicController = new MusicController(this); enemiesController.PacmanWanted += musicController.OnPacmanWanted; enemiesController.BonusEated += musicController.OnPacmanPowerUp; enemiesController.GhostEated += musicController.OnGhostEat; enemiesController.EnemyRestored += musicController.OnEnemyRestored; enemiesController.PacmanDie += musicController.OnPacmanDie; pacManController.BallEated += musicController.OnBallEated; pacman.GameEnd += OnGameEnd; }