// Update is called once per frame protected override void Update() { if (isDead || _isPaused) { return; } base.Update(); _currentMutationTime += Time.deltaTime; if (_currentMutationTime > MemoryMutationInterval) { Memory.MutateMemory(); _currentMutationTime = .0f; } if (_currentBehaviour.IsBehaviourFinished()) { _currentBehaviour = SelectNextBehaviour(); StartCoroutine(_currentBehaviour.DoBehaviour()); } else if (_currentBehaviour is WalkBehaviour && !_currentBehaviour.IsPaused) { if (((WalkBehaviour)_currentBehaviour).isMovingTarget) { ((WalkBehaviour)_currentBehaviour).UpdateTarget(); } } }
public void ChangeRoutine(List <BehaviourEntry> behaviourEntries) { InterruptNPC(); _isPaused = true; Routine = behaviourEntries; _currentBehaviourIdx = -1; _currentBehaviour = SelectNextBehaviour(); _isPaused = false; ResumeNPC(); }
// Start is called before the first frame update protected override void Start() { base.Start(); Memory = new InformationManager(this); _currentBehaviour = SelectNextBehaviour(); StartCoroutine(_currentBehaviour.DoBehaviour()); /* * Memory.TryAddNewInformation(new Information(FindObjectOfType<Player>().GetComponent<Player>(), * GameManager.Instance.WorldAdjectives[Adjectives.ALIVE]),this); * Memory.TryAddNewInformation(new Information(FindObjectOfType<Player>().GetComponent<Player>(), * GameManager.Instance.WorldAdjectives[Adjectives.evil]),this); */ /* * _currentBehaviour = new WalkBehaviour(this, GameObject.Find("Stable").transform); * _currentBehaviour.DoBehaviour(); */ }