FlagBase.cs 746 B

12345678910111213141516171819202122232425262728293031323334353637383940
  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. this.team = team;
  11. }
  12. public override TeamUtil.Team team {
  13. get {
  14. return base.team;
  15. }
  16. set {
  17. TeamUtil.Team oldTeam = base.team;
  18. base.team = value;
  19. if(Application.isPlaying || !Application.isEditor)
  20. {
  21. if(haloObj != null)
  22. Destroy(haloObj);
  23. if(value == TeamUtil.Team.Blue || value == TeamUtil.Team.Red)
  24. {
  25. haloObj = Instantiate<GameObject>(haloPrefabs[value.GetHashCode()-1]);
  26. haloObj.transform.SetParent(this.transform);
  27. haloObj.transform.localPosition = Vector3.zero;
  28. }
  29. }
  30. }
  31. }
  32. }