public GameStat(GameStat s, bool deep = false) { lose = s.lose; points = s.points; pos = s.pos; height = s.height; if (deep) { int length = s.dist.Length; dist = new int[length]; System.Array.Copy(s.dist, dist, length); length = s.obstacleType.Length; obstacleType = new ObstType[length]; System.Array.Copy(s.obstacleType, obstacleType, length); } else { dist = s.dist; obstacleType = s.obstacleType; } zSpeed = s.zSpeed; canLeft = s.canLeft; canRight = s.canRight; coins = s.coins; }
private void FixedUpdate() { stat = Extract(); if (display != null) { display.Display(stat); } }
private void Awake() { if (player != null) { playerRigidbody = player.GetComponent <Rigidbody>(); } else { Debug.LogError("Player is null!"); } Observer.GetInstance().Register(Observer.Event.CoinCollection, OnCoinCollect); // cache poolDealer = PoolDealer.Instance; poolDealer.CreatePool <int>("dist", 2, true, posMax); poolDealer.CreatePool <ObstType>("obstacles", 2, true, posMax); minDist = new float[posMax]; newStat = new GameStat(); }
public void Display(GameStat gameStat) { ready = true; stat = gameStat; }