Beispiel #1
0
 // Use this for initialization
 protected virtual void Start()
 {
     attackstates = Attackstates.Patrol;
     player       = GameObject.FindGameObjectWithTag("Player");
     animator     = GetComponent <Animator>();
     navMesh      = GetComponent <NavMeshAgent>();
     FieldOfView  = GetComponent <FieldOfView>();
     audioSource  = GetComponent <AudioSource>();
     Nav          = GetComponent <AINav>();
     Health       = MaxHealth;
 }
Beispiel #2
0
    // Update is called once per frame
    protected virtual void Update()
    {
        if (IsDeath)
        {
            return;
        }

        if (Health <= 0)
        {
            attackstates = Attackstates.Death;
        }
        switch (attackstates)
        {
        case Attackstates.Patrol:
            e_Patrol();
            break;

        case Attackstates.Alert:
            e_Alert();
            break;

        case Attackstates.Attacking:
            e_Attacking();
            break;

        case Attackstates.Death:
            e_Death();
            break;

        default:
            break;
        }
        if (HPSlider != null)
        {
            HPSlider.value = Health / MaxHealth;
        }
        targets = FieldOfView.ViewTargets;
        UpdateAttackState();
    }
Beispiel #3
0
 public void SetAttack()
 {
     attackstates = Attackstates.Attacking;
 }