示例#1
0
 private void spawnFruit(FoodSource.Fruit fruitType, bool skipStartAnimation)
 {
     FoodSource foodSource = new FoodSource(getRandomLocation(50, GameBoundaries), fruitType);
     foodSource.NoStartAnimation = skipStartAnimation;
     GameObjectManager.Instance.AddObject(foodSource);
 }
示例#2
0
        public void PlayNomSound(FoodSource aFood, GameTime aTime)
        {
            if (!_bSoundOn)
                return;

            if (_NomSoundMap.Count < 5)
            {
                // Each person goes into the map so we don't actually attempt
                // to play more than one sound of each person.
                if (!_NomSoundMap.ContainsKey(aFood))
                {
                    _NomSoundMap.Add(aFood, new SoundInfo());
                }

                SoundInfo info = _NomSoundMap[aFood];
                if (IsSoundFinished(ref info, s_NomSounds[info._iSoundIndex], aTime))
                {
                    info._iSoundIndex = RandomInstance.Instance.Next(0, s_NomSounds.Length);
                    info._iLastPlayTime = (int)aTime.TotalGameTime.TotalMilliseconds;
                    _NomSoundMap[aFood] = info;

                    s_NomSounds[info._iSoundIndex].Play();
                }
            }
        }
示例#3
0
 private void spawnFruit(FoodSource.Fruit fruitType)
 {
     GameObjectManager.Instance.AddObject(new FoodSource(getRandomLocation(50, GameBoundaries), fruitType));
 }