FriedrichLP

Untitled

Aug 2nd, 2018
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.05 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5. public class EntitySolider : soliderAI {
  6.  
  7. private string name;
  8. private int maxHealth;
  9.  
  10. private AIType aitype;
  11. private SoliderType soliderType;
  12.  
  13. private int health;
  14. private soliderAI ai;
  15.  
  16. public GameObject solider;
  17.  
  18. public EntitySolider (string name, Vector3 pos) : base (aitype, solidertype) {
  19. this.name = name;
  20.  
  21. generateRandomStats();
  22. ai = new soliderAI(aitype, soliderType);
  23.  
  24. GameObject soliderPrefab = GameObject.Find("EntitySoliderPrefab");
  25. solider = GameObject.Instantiate(soliderPrefab, pos, soliderPrefab.transform.rotation);
  26. }
  27.  
  28. void generateRandomStats() {
  29. int rnd = Random.Range(0, 1);
  30. if (rnd == 0) {
  31. this.aitype = AIType.FLAGS;
  32. } else {
  33. this.aitype = AIType.POINTS;
  34. }
  35. rnd = Random.Range(0, 1);
  36. if (rnd == 0) {
  37. this.soliderType = SoliderType.AGRESSIVE;
  38. } else {
  39. this.soliderType = SoliderType.OFFENSIVE;
  40. }
  41. this.maxHealth = 100 + Random.Range(-20, 20);
  42. }
  43.  
  44. public GameObject getSoliderObject () {
  45. return solider;
  46. }
  47. }
  48.  
  49.  
  50. using System;
  51. using System.Collections;
  52. using System.Collections.Generic;
  53. using UnityEngine;
  54.  
  55. public class soliderAI {
  56.  
  57. private AIType aitype;
  58. private SoliderType soliderType;
  59. private int detectionRange = 5;
  60.  
  61. public soliderAI (AIType aitype, SoliderType solidertype) {
  62. this.aitype = aitype;
  63. this.soliderType = solidertype;
  64.  
  65. GlobalEvents.AIUpdateEvent += OnAIUpdate;
  66. }
  67.  
  68. void OnAIUpdate (object sender, EventArgs e) {
  69.  
  70. }
  71.  
  72. void findNewPath () {
  73. switch (aitype) {
  74. case AIType.FLAGS:
  75.  
  76. break;
  77. case AIType.POINTS:
  78. Collider[] hits = Physics.OverlapSphere(.transform.position, detectionRange);
  79. break;
  80. }
  81. }
  82.  
  83. void targetNearestEnemie () {
  84.  
  85. }
  86. }
Advertisement
Add Comment
Please, Sign In to add comment