FriedrichLP

Untitled

Jul 24th, 2018
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.UI;
  5.  
  6. public class EntitySolider : EntityTroop {
  7.  
  8. private SoliderType type;
  9. private string name;
  10. private int id;
  11.  
  12. private static GameObject solider;
  13. private Sprite soliderStandart = Resources.Load<Sprite>("Textures/solider");
  14.  
  15. public EntitySolider(SoliderType type, string name, int id, GameObject parent) {
  16. this.type = type;
  17. this.name = name;
  18. this.id = id;
  19.  
  20. solider = new GameObject();
  21. solider.name = name;
  22. solider.transform.position = new Vector3(-40, 20, 0);
  23. solider.transform.parent = parent.transform;
  24. solider.transform.localScale = new Vector2(0.15f, 0.15f);
  25. Image image = solider.AddComponent<Image>();
  26. switch (this.type) {
  27. case SoliderType.STANDARD:
  28. image.sprite = soliderStandart;
  29. break;
  30. default:
  31. break;
  32. }
  33. }
  34.  
  35. public static void Update () {
  36. Debug.Log(solider);
  37. solider.transform.position += Vector3.right * 0.25f;
  38. }
  39.  
  40. public string GetName () {
  41. return this.name;
  42. }
  43.  
  44. public int GetId () {
  45. return this.id;
  46. }
  47. }
Advertisement
Add Comment
Please, Sign In to add comment