// Use this for initialization void Start() { anim = GetComponent <Animator>(); _StartPosision = transform.position; _playerController = GetComponent <CharacterController>(); #region Get Reset Scene Script _ResetButtonScript = _ResetButton.GetComponent <Reset_Scene_Script>(); if (_ResetButtonScript == null) { Debug.LogError("No se encontró el script del botón"); } #endregion audio = GameObject.FindObjectOfType <AudioAdmin>(); if (audio == null) { Debug.LogError("No se encontro Audio"); } ShowScore(); }
// Use this for initialization void Start() { #region initialize Player _initialSpeed = 5f; _speed = _initialSpeed; _runningSpeed = 10f; _playerController = GetComponent <CharacterController>(); //Obtener el Controlador _currentJumps = 0; _StartPosition = transform.position; totalClientsToAttend = 10; _isTriggeredHelper = false; #endregion _modelAnim = GetComponentInChildren <Animator>(); #region initialize Camera _zoom = -5f; _playerCamera.transform.localPosition = new Vector3(0, 0, _zoom); _playerCamera.LookAt(_focusPoint); #endregion #region initialize UI foodNumber = 0; moneyEarned = 0; lifeRemaining = 3; attendedClients = 0; ShowScore(); _WinLoseText.gameObject.SetActive(false); _BackgroundImage.enabled = false; #endregion #region Get Reset Scene Script _ResetButtonScript = _ResetButton.GetComponent <Reset_Scene_Script>(); if (_ResetButtonScript == null) { Debug.LogError("Button Script Missing"); } #endregion #region Puntaje _maxPuntaje = GameObject.FindGameObjectsWithTag("Food").Length; #endregion #region Audio _audio = FindObjectOfType <AudioAdmin>(); if (_audio == null) { Debug.LogError("Audio script could not be found."); } #endregion #region SpawnObjects enemiesSpawnObj = FindObjectOfType <SpawnObjects>(); if (enemiesSpawnObj == null) { Debug.LogError("'Enemies SpawnObjects' could not be found."); } clientsSpawnObj = FindObjectOfType <ClientSpawner>(); if (clientsSpawnObj == null) { Debug.LogError("'Clients SpawnObjects' could not be found"); } collectablesSpawnerObj = FindObjectsOfType <InfiniteSpawner>(); if (collectablesSpawnerObj == null) { Debug.LogError("'Infinite Spawners' could not be found"); } #endregion #region PlayerLife maxHealth = 100; health = maxHealth; healthBar.fillAmount = health / maxHealth; InvokeRepeating("EnergyLoss", 1, 1); #endregion }