Example #1
0
        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;
        }
Example #2
0
 private void FixedUpdate()
 {
     stat = Extract();
     if (display != null)
     {
         display.Display(stat);
     }
 }
Example #3
0
        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();
        }
Example #4
0
 public void Display(GameStat gameStat)
 {
     ready = true;
     stat  = gameStat;
 }