示例#1
0
        public void KillBox(GameComponent component)
        {
            ZoneBodies.Remove(component);
            var deathMotion = new EaseMotion(0.8f, component.LocalTransform, component.LocalTransform.Translation + new Vector3(0, -1, 0));

            component.AnimationQueue.Add(deathMotion);
            deathMotion.OnComplete += component.Die;
            SoundManager.PlaySound(ContentPaths.Audio.whoosh, component.LocalTransform.Translation);
            World.ParticleManager.Trigger("puff", component.LocalTransform.Translation + new Vector3(0.5f, 0.5f, 0.5f), Color.White, 90);
        }
示例#2
0
        public void KillCoins(Body component)
        {
            ZoneBodies.Remove(component);
            EaseMotion deathMotion = new EaseMotion(0.8f, component.LocalTransform, component.LocalTransform.Translation + new Vector3(0, -1, 0));

            component.AnimationQueue.Add(deathMotion);
            deathMotion.OnComplete += component.Die;
            SoundManager.PlaySound(ContentPaths.Audio.Oscar.sfx_ic_dwarf_stash_money, component.LocalTransform.Translation);
            Faction.World.ParticleManager.Trigger("puff", component.LocalTransform.Translation + new Vector3(0.5f, 0.5f, 0.5f), Color.White, 90);
        }
示例#3
0
 public override void Update()
 {
     if (ZoneBodies.Count > 0)
     {
         ZoneBodies.RemoveAll(body => body.IsDead);
         if (ZoneBodies.Count == 0)
         {
             Species = "";
         }
     }
     base.Update();
 }
示例#4
0
        public IEnumerable <Act.Status> RemoveAnimal(Body animal)
        {
            if (!ZoneBodies.Contains(animal))
            {
                yield return(Act.Status.Fail);

                yield break;
            }
            ZoneBodies.Remove(animal);
            animal.GetComponent <CreatureAI>().ResetPositionConstraint();
            Species = animal.GetComponent <Creature>().Species;
            yield return(Act.Status.Success);
        }
示例#5
0
        private void HandleBoxes()
        {
            if (Voxels == null || Boxes == null)
            {
                return;
            }

            if (Boxes.Any(b => b.IsDead))
            {
                ZoneBodies.RemoveAll(z => z.IsDead);
                Boxes.RemoveAll(c => c.IsDead);

                for (int i = 0; i < Boxes.Count; i++)
                {
                    Boxes[i].LocalPosition = new Vector3(0.5f, 1.5f, 0.5f) + Voxels[i].WorldPosition + VertexNoise.GetNoiseVectorFromRepeatingTexture(Voxels[i].WorldPosition + new Vector3(0.5f, 0, 0.5f));
                }
            }

            if (Voxels.Count == 0)
            {
                foreach (GameComponent component in Boxes)
                {
                    KillBox(component);
                }
                Boxes.Clear();
            }

            int numBoxes = Math.Min(Math.Max(Resources.TotalCount / ResourcesPerVoxel, 1), Voxels.Count);

            if (Resources.TotalCount == 0)
            {
                numBoxes = 0;
            }

            if (Boxes.Count > numBoxes)
            {
                for (int i = Boxes.Count - 1; i >= numBoxes; i--)
                {
                    KillBox(Boxes[i]);
                    Boxes.RemoveAt(i);
                }
            }
            else if (Boxes.Count < numBoxes)
            {
                for (int i = Boxes.Count; i < numBoxes; i++)
                {
                    CreateBox(Voxels[i].WorldPosition + VertexNoise.GetNoiseVectorFromRepeatingTexture(Voxels[i].WorldPosition + new Vector3(0.5f, 0, 0.5f)));
                }
            }
        }
示例#6
0
 public override void OnBuilt()
 {
     foreach (var body in ZoneBodies)
     {
         body.GetRoot().Delete();
     }
     ZoneBodies.Clear();
     foreach (
         var fence in
         Fence.CreateFences(World.ComponentManager, ContentPaths.Entities.DwarfObjects.fence, Voxels,
                            false))
     {
         AddBody(fence);
         fence.Manager.RootComponent.AddChild(fence);
     }
 }