// Update is called once per frame private void Update() { if (isStunned) { if (stunTimer < 0) { stunTimer = 3f; agent.speed = 3.5f; isStunned = false; TakeDamage(2); } else { stunTimer -= Time.deltaTime; agent.speed = 0; } } else { //FloatValue. AISelector.OnUpdate(); } if (Input.GetKeyDown(KeyCode.Space)) { TakeDamage(1); } FloatValue distance = BlackBoard.GetFloatVariableValue(VariableType.Distance); FloatValue hp = BlackBoard.GetFloatVariableValue(VariableType.Health); hp.Value = health; distance.Value = (Player.playerLocation - transform.position).magnitude; agent.SetDestination(targetPosition); //Deze werkt pas als de behaviours werken. }
void Update() { FloatValue distance = BlackBoard.GetFloatVariableValue(VariableType.Distance); AISelector.OnUpdate(); agent.SetDestination(targetPosition); }
public void OnInitialize() { AISelector = GetComponent <AIBehaviourSelector>(); BlackBoard = GetComponent <BlackBoard>(); BlackBoard.OnInitialize(); AISelector.OnInitialize(BlackBoard); }
public void TakeDamage(float damage) { FloatValue res = BlackBoard.GetFloatVariableValue(VariableType.Health); if (res) { res.Value -= damage; } AISelector.EvaluateBehaviours(); }
public void TakeDamage(float damage) { health -= damage; AISelector.EvaluateBehaviours(); if (health < 0) { Destroy(this); } }
public void InitDefault() { if (_owner.IsTypeId(TypeId.Unit)) { IMovementGenerator movement = AISelector.SelectMovementAI(_owner.ToCreature()); StartMovement(movement ?? staticIdleMovement, MovementSlot.Idle); } else { StartMovement(staticIdleMovement, MovementSlot.Idle); } }
// Update is called once per frame void Update() { AISelector.OnUpdate(); if (Input.GetKeyDown(KeyCode.Space)) { TakeDamage(10); } var distance = BlackBoard.GetFloatVariableValue(VariableType.Distance); distance.Value = transform.position.magnitude; }