private void OnEnable()
        {
            gameManagerMaster = GameObject.FindGameObjectWithTag("GameController").GetComponent <GameManager_Master>();
            _audioSource      = platformToRaise.GetComponent <AudioSource>();

            gameManagerMaster.ResetMovingPlatformsEvent += ResetMovingPlatform;
        }
        private void Awake()
        {
            gameManagerMaster = GameObject.FindGameObjectWithTag("GameController").GetComponent <GameManager_Master>();

            _animator = GetComponent <Animator>();

            dark = false;
        }
Example #3
0
 void SetInitialReferences()
 {
     gameManagerMaster = GameObject.FindGameObjectWithTag("GameController").GetComponent <GameManager_Master>();
     if (gameManagerMaster == null)
     {
         Debug.Log("gameManagerMaster null in ParallaxOriginReset.");
     }
 }
Example #4
0
        private void OnEnable()
        {
            gameManagerMaster = GetComponentInParent <GameManager_Master>();
            if (gameManagerMaster == null)
            {
                Debug.Log("Failed to get gameManager_Master from parent object. WorldGeneration - OnEnable.");
            }

            gameManagerMaster.ResetToOriginEvent += ResetToOrigin;

            platforms = new List <GameObject>();
        }
        private void SetInitialReferences()
        {
            gameManagerMaster = GameObject.FindGameObjectWithTag("GameController").GetComponent <GameManager_Master>();
            UIPrefabs         = GameObject.FindGameObjectWithTag("GameController").GetComponent <UIPrefabInit>();
            player            = GameObject.FindGameObjectWithTag("Player");
            achievReporter    = FindObjectOfType <AchievementReporter>();

            owned = false;

            //If we own the skin already disable locked image.
            for (int i = 0; i < NewSaveGame.Instance.ownedCharacters.Count; i++)
            {
                if ((int)Name == NewSaveGame.Instance.ownedCharacters[i])
                {
                    LockedImage.gameObject.SetActive(false);
                    owned = true;

                    CostText.text  = "Owned";
                    CostText.color = Color.black;
                }
            }

            if (!owned)
            {
                CostText.text = UnlockCost.ToString();
                if (NewSaveGame.Instance.pages >= UnlockCost)
                {
                    CostText.color = Color.black;
                }
                else
                {
                    CostText.color = Color.red;
                }
            }

            prefabSplit = NewSaveGame.Instance.prefabs[NewSaveGame.Instance.usedPrefab].Split(',');
            int.TryParse(prefabSplit[0], out usedBook);
            int.TryParse(prefabSplit[1], out usedOther);

            BookSkinSelect.SelectedBookSkin = usedBook;

            if ((int)Name == SelectedBookSkin)
            {
                gameObject.GetComponent <Image>().color = SelectedColorStatic;
            }
            else
            {
                gameObject.GetComponent <Image>().color = new Color32(255, 255, 255, 0);
            }
        }
Example #6
0
        void Awake()
        {
            GameManager_Master.gameState = GameState.Menu;
            ProCamera2D.Instance.OffsetX = menuCameraXOffset;

            gameManagerMaster = GameObject.FindGameObjectWithTag("GameController").GetComponent <GameManager_Master>();
            if (gameManagerMaster == null)
            {
                Debug.LogError("gameManagerMaster null in Movement - Awake.");
            }

            achievReporter = FindObjectOfType <AchievementReporter>();
            if (achievReporter == null)
            {
                Debug.LogError("achievReporter null in Movement - Awake.");
            }

            numberOriginResets                = 0;
            GameManager_Master.canRevive      = true;
            GameManager_Master.canRevivePages = true;
            startDelayActive = false;

            lastObjectTouched = null;

            runSpeedUnModified = runSpeed;
            runSpeed           = initialRunSpeed;

            currentGravity = gravity;

            //multiple sources used so I can do instant cutoff of run and glide sound when jump or land etc.
            AudioSource[] sources = GetComponents <AudioSource>();
            _audioSource      = sources[0];
            _glideAudioSource = sources[1];
            _runAudioSource   = sources[2];

            _animator = GetComponent <Animator>();
            _animator.SetFloat("RunMultiplier", 1);
            _controller = GetComponent <CharacterController2D>();

            _controller.onTriggerEnterEvent += onTriggerEnterEvent;
            _controller.onTriggerExitEvent  += onTriggerExitEvent;

            StartCoroutine(PlayerSpeedBuildUp());
        }
 void SetInitialReferences()
 {
     gameManagerMaster = GetComponent <GameManager_Master>();
 }
Example #8
0
 private void Awake()
 {
     gameManagerMaster = GameObject.FindGameObjectWithTag("GameController").GetComponent <GameManager_Master>();
 }
Example #9
0
 void SetInitialReferences()
 {
     gameManagerMaster = GameObject.FindGameObjectWithTag("GameController").GetComponent <GameManager_Master>();
 }