GameMode.cs 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. /* 游戏模式-祖先类 */
  5. public abstract class GameMode
  6. {
  7. public GameMgr gameMgr;
  8. public bool pauseTimeCounting {
  9. get {
  10. return timeCountingPauseLockers.Count > 0;
  11. }
  12. }
  13. HashSet<System.Object> timeCountingPauseLockers = new HashSet<System.Object>();
  14. public void PauseTimeCounting(System.Object o)
  15. {
  16. timeCountingPauseLockers.Add(o);
  17. }
  18. public void ResumeTimeCounting(System.Object o)
  19. {
  20. timeCountingPauseLockers.Remove(o);
  21. }
  22. public GameMode(GameMgr gameMgr) {
  23. this.gameMgr = gameMgr;
  24. }
  25. public virtual void HitTarget(float score) {}
  26. public virtual bool DoNextShoot() { return true; }
  27. public virtual object[] Settle() {return null; }
  28. public virtual void Start() {}
  29. public virtual void Update() {} //fixedUpdate
  30. public virtual void FrameUpdate() {}
  31. public virtual void onBowReady() {}
  32. public virtual void onBowShoot() {}
  33. public void BanBowReady() {
  34. PauseTimeCounting(this);
  35. ArmBow armBow = GameObject.FindObjectOfType<ArmBow>();
  36. armBow.banReady = true;
  37. armBow.banShoot = true;
  38. }
  39. public void UnbanBowReady() {
  40. ResumeTimeCounting(this);
  41. ArmBow armBow = GameObject.FindObjectOfType<ArmBow>();
  42. armBow.banReady = false;
  43. armBow.banShoot = false;
  44. armBow.readyShoot();
  45. }
  46. }