void Update() { if (delay.Over()) { delay.Start(); //Wait for frequency foreach (DissolveEffect dissolve in dissolvedMeshes) { dissolve.Constitute(); } dissolvedMeshes.Clear(); CMovement playerMove = Cache.Get.player.GetComponent <CMovement>(); if (!playerMove.IsInside()) { return; } RaycastHit[] hits; hits = Physics.RaycastAll(cam.position, playerMove.transform.position - cam.position, Vector3.Distance(playerMove.transform.position, cam.position)); for (int i = 0; i < hits.Length; i++) { RaycastHit hit = hits[i]; DissolveEffect dissolveMesh = hit.transform.GetComponent <DissolveEffect>(); if (dissolveMesh) { dissolveMesh.Dissolve(); dissolvedMeshes.Add(dissolveMesh); } } } }
void OnTriggerExit(Collider other) { DissolveEffect dissolve = other.GetComponent <DissolveEffect>(); if (dissolve) { dissolve.Constitute(); } }
void OnTriggerEnter(Collider other) { DissolveEffect dissolve = other.GetComponent <DissolveEffect>(); if (dissolve) { dissolve.Dissolve(); } }
private void Awake() { if (instance == null) { instance = this; } else { Destroy(this); } }
// Start is called before the first frame update void Start() { animator = GetComponent <Animator>(); if (!animator) { animator = GetComponentInChildren <Animator>(); } player = GameObject.FindGameObjectWithTag("Player").transform; if (!player) { Debug.Log("No Player Found"); return; } dissolveEffect = GetComponentInParent <DissolveEffect>(); }
protected override void Start() { base.Start(); IdleState = new Slime_IdleState(FiniteStateMachine, this, "idle", _idleStateData, this); JumpingMoveState = new Slime_JumpingMoveState(FiniteStateMachine, this, "jumpingMove", _jumpingMoveStateData, this); PlayerDetectedState = new Slime_PlayerDetectedState(FiniteStateMachine, this, "playerDetected", _playerDetectedStateData, this); MeleeAttackState = new Slime_MeleeAttackState(FiniteStateMachine, this, "meleeAttack", _meleeAttackPosition, _meleeAttackStateData, this); AreaAttackState = new Slime_AreaAttackState(FiniteStateMachine, this, "areaAttack", _areaAttackPosition, _areaAttackStateData, this); DamageState = new Slime_DamageState(FiniteStateMachine, this, "damage", _damageStateData, this); StunState = new Slime_StunState(FiniteStateMachine, this, "stun", _stunStateData, this); DeadState = new Slime_DeadState(FiniteStateMachine, this, "dead", _deadStateData, this); FiniteStateMachine.Initialize(IdleState); DissolveEffect = new DissolveEffect(); }
protected override void Start() { base.Start(); IdleState = new Ogre_IdleState(FiniteStateMachine, this, "idle", _idleStateData, this); MoveState = new Ogre_MoveState(FiniteStateMachine, this, "move", _moveStateData, this); PlayerDetectedState = new Ogre_PlayerDetectedState(FiniteStateMachine, this, "playerDetected", _playerDetectedStateData, this); // TODO: OGRE create look for player animation LookForPlayerState = new Ogre_LookForPlayerState(FiniteStateMachine, this, "lookForPlayer", _lookForPlayerStateData, this); MeleeAttackState = new Ogre_MeleeAttackState(FiniteStateMachine, this, "meleeAttack", _meleeAttackPosition, _meleeAttackStateData, this); SpecificAreaAttackState = new Ogre_SpecificAreaAttackState(FiniteStateMachine, this, "specificAreaAttack", _specificAreaAttackStateData, this); DamageState = new Ogre_DamageState(FiniteStateMachine, this, "damage", _damageStateData, this); StunState = new Ogre_StunState(FiniteStateMachine, this, "stun", _stunStateData, this); DeadState = new Ogre_DeadState(FiniteStateMachine, this, "dead", _deadStateData, this); FiniteStateMachine.Initialize(IdleState); DissolveEffect = new DissolveEffect(); }
protected override void Start() { base.Start(); IdleState = new Boar_IdleState(FiniteStateMachine, this, "idle", _idleStateData, this); MoveState = new Boar_MoveState(FiniteStateMachine, this, "move", _moveStateData, this); PlayerDetectedState = new Boar_PlayerDetectedState(FiniteStateMachine, this, "playerDetected", _playerDetectedStateData, this); ChargeState = new Boar_ChargeState(FiniteStateMachine, this, "charge", _chargeStateData, this); LookForPlayerState = new Boar_LookForPlayerState(FiniteStateMachine, this, "lookForPlayer", _lookForPlayerStateData, this); SlowDownState = new Boar_SlowDownState(FiniteStateMachine, this, "slowDown", _slowDownStateData, this); MeleeAttackState = new Boar_MeleeAttackState(FiniteStateMachine, this, "meleeAttack", _meleeAttackPosition, _meleeAttackStateData, this); DamageState = new Boar_DamageState(FiniteStateMachine, this, "damage", _damageStateData, this); StunState = new Boar_StunState(FiniteStateMachine, this, "stun", _stunStateData, this); DeadState = new Boar_DeadState(FiniteStateMachine, this, "dead", _deadStateData, this); FiniteStateMachine.Initialize(MoveState); DissolveEffect = new DissolveEffect(); }
protected override void Start() { base.Start(); IdleState = new GoblinArcher_IdleState(FiniteStateMachine, this, "idle", _idleStateData, this); MoveState = new GoblinArcher_MoveState(FiniteStateMachine, this, "move", _moveStateData, this); PlayerDetectedState = new GoblinArcher_PlayerDetectedState(FiniteStateMachine, this, "playerDetected", _playerDetectedStateData, this); LookForPlayerState = new GoblinArcher_LookForPlayerState(FiniteStateMachine, this, "lookForPlayer", _lookForPlayerStateData, this); MeleeAttackState = new GoblinArcher_MeleeAttackState(FiniteStateMachine, this, "meleeAttack", _meleeAttackPosition, _meleeAttackStateData, this); DodgeState = new GoblinArcher_DodgeState(FiniteStateMachine, this, "dodge", _dodgeStateData, this); RangedAttackState = new GoblinArcher_RangedAttackState(FiniteStateMachine, this, "rangedAttack", _rangedAttackPosition, _rangedAttackStateData, this); DamageState = new GoblinArcher_DamageState(FiniteStateMachine, this, "damage", _damageStateData, this); StunState = new GoblinArcher_StunState(FiniteStateMachine, this, "stun", _stunStateData, this); DeadState = new GoblinArcher_DeadState(FiniteStateMachine, this, "dead", _deadStateData, this); FiniteStateMachine.Initialize(MoveState); DissolveEffect = new DissolveEffect(); }
// Start is called before the first frame update void Start() { //set the players position when initiated transform.position = new Vector3(-4.5f, 0, 0); _spawnManager = GameObject.Find("Spawn Manager").GetComponent <SpawnManager>(); if (_spawnManager == null) { Debug.Log("Spawn manager is NULL"); } _uIManager = GameObject.Find("UIManager").GetComponent <UIManager>(); if (_uIManager == null) { Debug.Log("UI Manager is null"); } _uIManager.UpdateBullets(_maxAmmo); _currentAmmo = 15; sfx = GameObject.FindWithTag("GameData").GetComponentsInChildren <AudioSource>(); _cameraShake = GameObject.Find("CameraShake").GetComponent <CameraShake>(); _lives = _maxLives; _healthBar.SetHealth((float)_lives, (float)_maxLives); _dissolveEffect = _shieldPrefab.GetComponentInChildren <DissolveEffect>(); _dissolveEffect.StartDissolve(1f); }
IEnumerator Teleport() { //Gets components needed DissolveEffect dissolveEffect = Player.GetComponent <DissolveEffect>(); PlayerMovement playerMovement = Player.GetComponent <PlayerMovement>(); Teleporter teleport = otherTeleporter.GetComponent <Teleporter>(); dissolveEffect.StartDissolve(2f); yield return(new WaitForSeconds(1f)); //Teleports the player PlayerController.isGamePaused = true; Player.transform.position = new Vector2(otherDestination.transform.position.x, otherDestination.transform.position.y); teleport.allowTeleport = false; dissolveEffect.StopDissolve(2f); yield return(new WaitForSeconds(0.35f)); PlayerController.isGamePaused = false; yield return(new WaitForSeconds(0.2f)); teleport.allowTeleport = true; }
void Awake() { t = target as DissolveEffect; }
private void Awake() { m_dissolveEffect = gameObject.GetComponent <DissolveEffect>(); }