private void Awake() { musicManager = FindObjectOfType <MusicManager>(); audioSource = GetComponent <AudioSource>(); clamshells = FindObjectsOfType <Clamshell>(); player = FindObjectOfType <PlayerController>(); puzzleButton = FindObjectOfType <PuzzleButtonOne>(); }
private void OnTriggerEnter2D(Collider2D other) { if (other.tag == "Gridpoint") { Gridpoint gridpoint = other.GetComponent <Gridpoint>(); gridpoint.isOccupied = true; } else if (other.tag == "Clamshell") { Clamshell shell = other.GetComponent <Clamshell>(); int shellNumber = shell.puzzleNumber; PuzzleButtonOne puzzleButton = FindObjectOfType <PuzzleButtonOne>(); puzzleButton.AddPearlSoundToPlay(pearlNumber, shellNumber); DeactivatePearl(); } }
private void OnTriggerEnter2D(Collider2D other) { if (other.tag == "Pearl") { AudioSource pearlAudio = other.GetComponent <AudioSource>(); if (pearlAudio.isPlaying) { pearlAudio.Stop(); } Pearl pearl = other.GetComponent <Pearl>(); if (collisionChecker.collisions.above) { pearl.MoveUp(); } else if (collisionChecker.collisions.below) { pearl.MoveDown(); } else if (collisionChecker.collisions.left) { pearl.MoveLeft(); } else if (collisionChecker.collisions.right) { pearl.MoveRight(); } } if (other.tag == "PearlInteractZone") { Pearl pearl = other.GetComponentInParent <Pearl>(); if (!pearl.hasBeenPushed) { pearl.PlayPuzzleSound(); } } if (other.tag == "InteractZone") { InteractZone zone = other.GetComponent <InteractZone>(); zone.ActivatedButtonSprite(); } if (other.tag == "PuzzleShellTwo") { ShellPuzzleTwo shell = other.GetComponent <ShellPuzzleTwo>(); shell.ActivateShell(); } if (other.tag == "PuzzleShellTwoInteractZone") { ShellPuzzleTwo shell = other.GetComponentInParent <ShellPuzzleTwo>(); shell.PlayShellSound(); shell.ActivatedButtonSprite(); } if (other.tag == "PuzzleButtonOne") { PuzzleButtonOne button = other.GetComponentInParent <PuzzleButtonOne>(); if (!button.isPuzzleSolved) { button.PlayPuzzleSounds(); } } if (other.tag == "PuzzleButtonTwo") { PuzzleButtonTwo button = other.GetComponentInParent <PuzzleButtonTwo>(); if (!button.isPuzzleSolved) { button.PlayPuzzleSounds(); } } if (other.tag == "PuzzleButtonThree") { PuzzleButtonThree button = other.GetComponent <PuzzleButtonThree>(); if (!button.isPuzzleSolved) { button.ActivateDialogueBox(); canMove = false; } } if (other.tag == "EnterZone") { MountainEntry mountain = other.GetComponent <MountainEntry>(); int mountainNumber = mountain.mountainNumber; gameManager.currentMountainNumber = mountainNumber; mountain.EnterMountain(); } if (other.tag == "ExitZone") { gameManager.playerExitingMountain = true; MountainExit mountain = other.GetComponent <MountainExit>(); mountain.ExitMountain(); } if (other.tag == "GrassZone") { playerSoundManager.surface = PlayerSoundManager.Surface.grass; } }