コード例 #1
0
 // Special stuff
 public void reap(Person casualty)
 {
     GameObjectManager.Instance.AddObject(new Angel(casualty.Location, casualty));
 }
コード例 #2
0
 public void registerDead(Person casualty)
 {
     _CountDead++;
     GameObjectManager.Instance.AddObject(new Tombstone(casualty.Location));
     GameObjectManager.Instance.RemoveObject(casualty);
 }
コード例 #3
0
 private void RemoveFromFlock(Person aPerson)
 {
     _People.Remove(aPerson);
     GameObjectManager.Instance.AddObject(aPerson);
     aPerson.RemovedFromFlock();
 }
コード例 #4
0
        public void PlayAngrySound(Person aPerson, GameTime aTime)
        {
            if (!_bSoundOn)
                return;

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

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

                    s_AngrySounds[info._iSoundIndex].Play();
                }
            }
        }
コード例 #5
0
 private void AddToFlock(Person aPerson)
 {
     GameObjectManager.Instance.RemoveObject(aPerson);
     _People.Add(aPerson);
     aPerson.AddedToFlock(this);
 }
コード例 #6
0
 public void RemovePerson(Person aPerson)
 {
     _RemovePeople.Add(aPerson);
 }
コード例 #7
0
        public Vector2 GetExternalForces(Person aPerson)
        {
            Vector2 force = Vector2.Zero;
            for (int i = 0; i < _ExternalForces.Count; ++i)
            {
                float fdist = Vector2.Distance(aPerson.Location, _ExternalForces[i].Location);
                Vector2 direction = aPerson.Location - _ExternalForces[i].Location;
                direction.Normalize();

                float ffactor = _ExternalForces[i].fForce - (fdist * _ExternalForces[i].fFalloff);
                if(ffactor > 0)
                    force += direction * ffactor;
            }

            return force;
        }
コード例 #8
0
 public void AddPerson(Person aPerson)
 {
     _AddPeople.Add(aPerson);
 }
コード例 #9
0
ファイル: Angel.cs プロジェクト: darrentorpey/game_of_nom
 public Angel(Vector2 aStartLocation, Person mortalRemains)
 {
     Location = aStartLocation;
     _MortalRemains = mortalRemains;
 }