Example #1
0
    // Use this for initialization
    void Start()
    {
        //Get Audiomanager
        try
        {
            audioManager = FindObjectOfType <AudioManager>();
        }

        catch
        {
            Debug.LogWarning("Could not find audio Manager");
        }

        audioPlayed = false;

        //Init pickups
        NumberFoundClams = 0;

        clamUiImages.Add(GameObject.Find("ClamUI1").GetComponent <Image>());
        clamUiImages.Add(GameObject.Find("ClamUI2").GetComponent <Image>());
        clamUiImages.Add(GameObject.Find("ClamUI3").GetComponent <Image>());

        //Get parent object
        rootObject = gameObject.transform.parent.gameObject;

        //Get components -> should have null checks. RequireComponent could be good.
        deathManager = gameObject.GetComponent <DeathManager>();
        hidePlayer   = gameObject.GetComponent <HidePlayer>();
        followCamera = rootObject.GetComponentInChildren <Cinemachine.CinemachineVirtualCamera>();
        timer        = gameObject.GetComponent <Timer>();

        armRadius = gameObject.GetComponentInChildren <SpriteRenderer>();

        //Find the SceneData object in the scene and store it's data script.
        //There may well be a nicer way of doing this.
        try
        {
            sceneData = GameObject.Find("SceneData").GetComponent <SceneData>();
        }

        catch (System.NullReferenceException)
        {
            Debug.LogError("No SceneData component in scene. Add a SceneData prefab! \nAlternatively you may have renamed it to something other than SceneData.");
        }

        //Get the checkpoint manager from the parent transform. Could put the checkpoint manager just on the octo itself possibly.
        checkpointManager = gameObject.GetComponentInParent <CheckpointManager>();
    }
Example #2
0
 /// <summary>
 /// Instantiates the first death model at the start of the level.
 /// </summary>
 private void Awake()
 {
     hidePlayer = gameObject.GetComponent <HidePlayer>();
 }
Example #3
0
 private void AppBarButton_Click_1(object sender, RoutedEventArgs e)
 {
     MainFrame.Navigate(typeof(NowPlaying));
     HidePlayer.Begin();
 }