// Use this for initialization void Awake() { if (Instance == this) { _menuRef = Menuing.Instance; _managerRef = GameManager.Instance; _managerRef.SetGameReset += ResetPlayer; _playerMenuPos = transform.position; _playerMenuRot = transform.rotation; DontDestroyOnLoad(gameObject); } else { //Debug.Log("player copy Destroyed"); Destroy(gameObject); } _playerStartPos = _playerMenuPos; _playerStartRot = _playerMenuRot; _myRenderer = transform.GetChild(0).gameObject; _myAnimations = GetComponent <Animator>(); reachCheckpoint = false; }
//start Function //checks if the trap is independent of a room //calls Init based on whether or not independent protected virtual void Start() { _menuRef = Menuing.Instance; if (_independentTrap) { Init(); } }
// Use this for initialization public void Init(float _damage) { _movement = transform.forward * _dartSpeed * Time.deltaTime; _dartDamage = _damage; transform.parent = null; _menuRef = Menuing.Instance; _init = true; }
private void Awake() { if (Instance == this) { DontDestroyOnLoad(gameObject); } else { Destroy(gameObject); } _playerRef = PlayerController.Instance; _menuRef = Menuing.Instance; }
//base Init that is called when the player enters the room public virtual void Init() { _startPos = transform.position; _startRot = transform.rotation; _myRenderer = GetComponent <MeshRenderer>(); _myMaterial = _myRenderer.materials[1]; _myColor = _myMaterial.color; _menuRef = Menuing.Instance; _playerRef = PlayerController.Instance; _managerRef = GameManager.Instance; _cameraRef = _playerRef.GetCamera; _camOffset = _cameraRef.GetOffset; _enemyAgent = GetComponent <NavMeshAgent>(); _enemyAgent.enabled = false; if (!_managerRef.HardModeOn) { _actualMaxHealth = _maxBossHealth; _actualBossSpeed = _bossDefaultSpeed; } else { _actualMaxHealth = _maxHardBossHealth; _actualBossSpeed = _bossHardDefaultSpeed; } _currBossHealth = _actualMaxHealth; _currSpeed = _actualBossSpeed; _bossBar = _menuRef.GetBossBar; _laggedBossHealthBar = _bossBar.transform.GetChild(1).gameObject.GetComponent <Image>(); _laggedBossHealthBar.fillAmount = 1; _actualBossHealthBar = _bossBar.transform.GetChild(2).gameObject.GetComponent <Image>(); _actualBossHealthBar.fillAmount = 1; _bossNameText = _bossBar.transform.GetChild(3).gameObject.GetComponent <Text>(); _bossNameText.text = _bossName; if (_managerRef.HasSubtitles) { _bossNameText.text += ", " + _bossSubTitle; } _hasInit = true; }
// Use this for initialization public virtual void Init(DungeonMechanic _spawner, Mechanic _incomingMech) { _myAgent = GetComponent <NavMeshAgent>(); _mySpawner = _spawner; _myMechanic = _incomingMech; _target = PlayerController.Instance; _menuRef = Menuing.Instance; _myBody = transform.GetChild(2).gameObject; _myRenderer = _myBody.GetComponent <SkinnedMeshRenderer>(); _mySpookiness = _myRenderer.materials[1]; if (_myMechanic == Mechanic.COLOR) { _mySpookiness.color = _myColor; } _spookColor = _mySpookiness.color; _spookColor.a = 0; _mySpookiness.color = _spookColor; _myRenderer.materials[1] = _mySpookiness; _myAnimations = GetComponent <Animator>(); _myAnimations.Play("Movement", 0); }
// Use this for initialization public virtual void Init(GameObject _ghostThatShotMe) { _menuRef = Menuing.Instance; _myPillar = _ghostThatShotMe; _init = true; }