// Update is called once per frame private void Update() { if (_health.IsDead || _target == null) { return; } if (_restTimer > 0) { _restTimer -= Time.deltaTime; return; } if (_targetHealth.IsDead) { _isAttacked = false; _actionScheduler.CancelCurrentAction(); } if (DistanceToPlayer() && Fighter.CanAttack(_target) && !IsGoingHome || _isAttacked) { AttackBehaviour(); } else { PreparePatrolBehaviour(); PatrolBehaviour(); } if (patroller != null) { _timeSinceLastBreak += Time.deltaTime; } }
void DeathCheack() { if (IsDead) { //onDeathTest(); SetComponent(); myAnimator.TriggerDeath(); actionScheduler.CancelCurrentAction();//????? } }
public void RestoreState(object state) { _agent.enabled = false; transform.position = ((SerializableVector3)state).ToVector3(); _agent.enabled = true; _actionScheduler.CancelCurrentAction(); }
public void Die() { if (_isDead) { return; } _isDead = true; if (_anim != null) { _anim.SetTrigger("die"); } if (_actionScheduler != null) { _actionScheduler.CancelCurrentAction(); } //foreach (var item in _colliders) //{ // item.enabled = false; //} //foreach (var item in _components) //{ // item.enabled = false; //} if (_colliders != null) { new List <Collider>(_colliders).ForEach(item => item.enabled = false); } if (_components != null) { new List <MonoBehaviour>(_components).ForEach(item => item.enabled = false); } }
// placeholder parameter void DisablePlayerControl(PlayableDirector stuff) { if (pc != null) { print("disabling control"); actionScheduler.CancelCurrentAction(); pc.enabled = false; } }
public void RestoreState(object state) { var position = (SerializableVector3)state; m_NavMeshAgent.enabled = false; transform.position = position.ToVector(); m_NavMeshAgent.enabled = true; m_ActionScheduler.CancelCurrentAction(); }
private void Die() { if (IsDead) { return; } IsDead = true; if (_animator != null) { _animator.SetTrigger("die"); } if (_actionScheduler != null) { _actionScheduler.CancelCurrentAction(); } //_capsuleCollider.enabled = false; //_navMeshAgent.enabled = false; Enemy enemy = gameObject.GetComponent <Enemy>(); if (enemy) { GameManager.Instance.uiManager.LevelManagerGO.GetComponent <LevelManager>().levelWindow.levelSystem.AddExperience(enemy.XpValue); if (spawner != null) { spawner.RemoveObject(gameObject); } } if (_death != null) { StopCoroutine(_death); } if (!CompareTag("Player")) { var gold = (int)Random.Range(GetComponent <CombatTarget>().MINGold, GetComponent <CombatTarget>().MAXGold); GameManager.Instance.player.inventory.gold += gold; _death = StartCoroutine(DestroyEnemy(_combatTarget.ListLoot.Count > 0 ? destroyTimeWithLoot : destroyTime)); PurgeManager.Instance.killedCount += 1; if (GetComponent <AISpellController>() == null) { return; } GameManager.Instance.Boss.SetActive(true); } else { StartCoroutine(RespawnPlayer()); } }
private void Die() { if (IsDead) { return; } m_Animator.SetTrigger(s_Die); m_ActionScheduler.CancelCurrentAction(); IsDead = true; }
private void Die(bool immediate = false) { isDead = true; if (immediate) { anim.Play("Death", 0, 1); } else { anim.SetTrigger("DeathTrigger"); } actionScheduler.CancelCurrentAction(); }
public void RestoreState(object state) { if (!isInited) { Init(); } SerializableVector3 pos = (SerializableVector3)state; agent.enabled = false; transform.position = pos.ToVector3(); agent.enabled = true; actionScheduler.CancelCurrentAction(); }
public void StartMoveAction(Vector3 position, float speedFraction = 1f) { if (attackIsAnimating) { return; } if (GetComponent <Health>() != null && !GetComponent <Health>().Alive) { return; } ActionScheduler actionScheduler = GetComponent <ActionScheduler>(); actionScheduler.CancelCurrentAction(); actionScheduler.StartAction(this); MoveTo(position, Mathf.Clamp01(speedFraction)); }
private void AttackPlayer() { if (IsAggrevated()) { timeSinceLastSawPlayer = 0; enemyFighter.Attack(player); AggrevateNearbyEnemies(); } else if (timeSinceLastSawPlayer < susWaitTime) { actionScheduler.CancelCurrentAction(); } else { PatrolBehavior(); } }
private void Die() { if (isDead) { return; } isDead = true; GetComponent <Animator>().SetTrigger("die"); GetComponent <CapsuleCollider>().enabled = false; ActionScheduler actionScheduler = GetComponent <ActionScheduler>(); Transform interactionCollider = transform.Find("InteractionCollider"); if (interactionCollider != null) { Destroy(interactionCollider.gameObject); } if (actionScheduler == null) { return; } actionScheduler.CancelCurrentAction(); }
private void PatrolBehaviour() { //initialize first destination Vector3 nextPosition = m_PositionToGuard; if (m_PatrolPath != null) { if (AtWayPoint()) { m_ActionScheduler.CancelCurrentAction(); m_TimeSinceArrivedAtLastWaypoint = 0f; CycleWayPoint(); } nextPosition = GetCurrentWaypoint(); } //Don't move until we have dwelled first if (m_TimeSinceArrivedAtLastWaypoint > m_WaypointDwellTime) { m_Mover.StartMoveAction(nextPosition); } }
private void DisableControl(PlayableDirector pd) { m_ActionScheduler.CancelCurrentAction(); m_PlayerController.enabled = false; OnCinematicStart(true); }
private void SuspicionBehaviour() { // Suspicion state actionScheduler.CancelCurrentAction(); }
private void DisableControl(PlayableDirector _) { playerActionScheduler.CancelCurrentAction(); playerController.enabled = false; }
private void SuspicionBehavior() { actionScheduler.CancelCurrentAction(); }
private void SuspicionBehaviour() { actionScheduler.CancelCurrentAction(); hasShouted = false; }
public void CancelCurrentAction() { actionScheduler.CancelCurrentAction(); }
private void Die() { GetComponent <Animator>().SetTrigger("die"); isDead = true; actionScheduler.CancelCurrentAction(); }
private void Die() { isDead = true; animator.SetTrigger("die"); actionScheduler.CancelCurrentAction(); }