Enemy.cs 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. public class Enemy : MonoBehaviour
  5. {
  6. private float power;
  7. private enum PowerLevels { VeryLow, Low, Medium, High, Full}
  8. [SerializeField]
  9. private PowerLevels powerLevel;
  10. private EnemyAI.BehaviorController behaviorController;
  11. void OnCollisionEnter(Collision collision)
  12. {
  13. Debug.Log("hlk" + collision.collider.tag);
  14. if (collision.collider.tag == "Bullet")
  15. {
  16. Death();
  17. }
  18. }
  19. // Use this for initialization
  20. void Start ()
  21. {
  22. behaviorController = new EnemyAI.BehaviorController();
  23. behaviorController.blackboard.navMeshAgent = GetComponent<UnityEngine.AI.NavMeshAgent>();
  24. }
  25. // Update is called once per frame
  26. void Update ()
  27. {
  28. EnemyAI.Blackboard blackboard = behaviorController.blackboard;
  29. // TODO get state
  30. blackboard.Night = true;
  31. // TODO get position
  32. blackboard.PlayerPosition = GameObject.FindGameObjectWithTag("Player").transform.position;
  33. blackboard.EnemyPosition = transform.position;
  34. behaviorController.Update();
  35. }
  36. private void Death()
  37. {
  38. GameObject.Destroy(gameObject);
  39. }
  40. }