fork download
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.UI;
  5.  
  6. public class EnemyMovement : MonoBehaviour
  7. {
  8. Transform player;
  9. public UnityEngine.AI.NavMeshAgent nav;
  10. Rigidbody rb;
  11.  
  12. public float enemyHpMax;
  13. //[HideInInspector]
  14. public float enemyHpCurrent;
  15. public Image enemyHealthBar;
  16.  
  17. GameObject tmObject;
  18. TimeManager tm;
  19.  
  20. public GameObject bttObject;
  21. BulletTimeTrigger btt;
  22.  
  23. public GameObject deathEffect;
  24.  
  25.  
  26.  
  27.  
  28.  
  29. void Awake ()
  30. {
  31. enemyHpCurrent = enemyHpMax;
  32. player = GameObject.FindGameObjectWithTag ("Player").transform;
  33. tmObject= GameObject.FindGameObjectWithTag ("time_manager");
  34. tm = tmObject.GetComponent<TimeManager> ();
  35. rb = GetComponent<Rigidbody> ();
  36. btt = bttObject.GetComponent<BulletTimeTrigger>();
  37.  
  38.  
  39.  
  40.  
  41.  
  42. }
  43.  
  44.  
  45. void Update ()
  46. {
  47.  
  48. if (nav != null) {
  49. nav.SetDestination (player.position);
  50. }
  51. if (enemyHpCurrent <= 0f) {
  52.  
  53. Instantiate (deathEffect, transform.position, transform.rotation);
  54. btt.RemoveEnemy (gameObject);
  55. Destroy (gameObject);
  56.  
  57. }
  58.  
  59.  
  60.  
  61.  
  62. }
  63. public void TriggeredOnPlayer(){
  64.  
  65. nav = GetComponent <UnityEngine.AI.NavMeshAgent> ();
  66. rb.isKinematic = false;
  67. }
  68.  
  69. void OnCollisionEnter(Collision col){
  70. if(col.gameObject.tag=="Player"){
  71. //tm.enemyIsDead = true;
  72. Instantiate (deathEffect, transform.position, transform.rotation);
  73. btt.RemoveEnemy (gameObject);
  74. Destroy(gameObject);
  75.  
  76.  
  77.  
  78. }
  79. }
  80.  
  81. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cs(3,7): error CS0246: The type or namespace name `UnityEngine' could not be found. Are you missing an assembly reference?
prog.cs(4,7): error CS0246: The type or namespace name `UnityEngine' could not be found. Are you missing an assembly reference?
prog.cs(6,30): error CS0246: The type or namespace name `MonoBehaviour' could not be found. Are you missing an assembly reference?
prog.cs(8,2): error CS0246: The type or namespace name `Transform' could not be found. Are you missing an assembly reference?
prog.cs(9,9): error CS0246: The type or namespace name `UnityEngine' could not be found. Are you missing an assembly reference?
prog.cs(10,2): error CS0246: The type or namespace name `Rigidbody' could not be found. Are you missing an assembly reference?
prog.cs(15,9): error CS0246: The type or namespace name `Image' could not be found. Are you missing `System.Drawing' using directive?
prog.cs(17,2): error CS0246: The type or namespace name `GameObject' could not be found. Are you missing an assembly reference?
prog.cs(18,2): error CS0246: The type or namespace name `TimeManager' could not be found. Are you missing an assembly reference?
prog.cs(20,9): error CS0246: The type or namespace name `GameObject' could not be found. Are you missing an assembly reference?
prog.cs(21,2): error CS0246: The type or namespace name `BulletTimeTrigger' could not be found. Are you missing an assembly reference?
prog.cs(23,9): error CS0246: The type or namespace name `GameObject' could not be found. Are you missing an assembly reference?
prog.cs(69,24): error CS0246: The type or namespace name `Collision' could not be found. Are you missing an assembly reference?
Compilation failed: 13 error(s), 0 warnings
stdout
Standard output is empty