Beispiel #1
0
    public override void Reason(BleddynController bleddynController)
    {
        bool canSeePlayer = bleddynController.GetComponent <FieldOfView>().CanSeePlayer();

        if (canSeePlayer)
        {
            bleddynController.SetTransition(Transition.SawPlayer);
        }
    }
Beispiel #2
0
    public override void Reason(BleddynController bleddynController)
    {
        bool canSeePlayer = bleddynController.GetComponent <FieldOfView>().CanSeePlayer();

        float distanceToPlayer = Vector3.Distance(bleddynController.transform.position, bleddynController.playerTransform.position);

        if (distanceToPlayer < bleddynController.bleddynConfig.attackRange)
        {
            Debug.Log("AttackPlayer");
            bleddynController.SetTransition(Transition.ReachedPlayer);
        }

        if (!canSeePlayer)
        {
            bleddynController.lastKnownPlayerPosition = bleddynController.playerTransform.position;
            bleddynController.SetTransition(Transition.LostPlayer);
        }
    }