FlagBase.cs 771 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. using UnityEngine;
  2. using System.Collections;
  3. public class FlagBase : MapBase
  4. {
  5. public GameObject[] haloPrefabs;
  6. private GameObject haloObj;
  7. public override void Init(Map map)
  8. {
  9. base.Init(map);
  10. }
  11. public override TeamUtil.Team team {
  12. get {
  13. return base.team;
  14. }
  15. set {
  16. TeamUtil.Team oldTeam = base.team;
  17. base.team = value;
  18. if(oldTeam != value)
  19. {
  20. if(Application.isPlaying || !Application.isEditor)
  21. {
  22. if(haloObj != null)
  23. Destroy(haloObj);
  24. if(value == TeamUtil.Team.Blue || value == TeamUtil.Team.Red)
  25. {
  26. haloObj = Instantiate<GameObject>(haloPrefabs[value.GetHashCode()-1]);
  27. haloObj.transform.SetParent(this.transform);
  28. haloObj.transform.localPosition = Vector3.zero;
  29. }
  30. }
  31. }
  32. }
  33. }
  34. }