示例#1
0
文件: TCell.cs 项目: Wydra/LD24
        public override void Update(SceneGraph graph)
        {
            base.Update(graph);

            ticks = ticks % 120;
            if (ticks == 0)
            {
                 Velocity = RNG.RandomUnitVector();
            }

            ticks++;
        }
示例#2
0
 public override void Update(SceneGraph graph)
 {
 }
示例#3
0
文件: Cell.cs 项目: Wydra/LD24
        public override void Update(SceneGraph graph)
        {
            base.Update(graph);

            if (State == CellState.Dead)
            {
                if (DeathCounter > 0)
                {
                    DeathCounter--;
                    Tint = new Color(Tint.R, Tint.G, Tint.B, DeathCounter);
                }
                else
                {
                    graph.Remove(this);
                }
            }
        }
示例#4
0
文件: Sprite.cs 项目: Wydra/LD24
        public virtual void Update(SceneGraph graph)
        {
            if (Velocity != Vector2.Zero)
            {
                Vector2 newPosition = Position;

                newPosition.X += Velocity.X * Speed;
                newPosition.Y += Velocity.Y * Speed;
                Position = newPosition;
            }

            if (IsAnimating && Animation != null)
            {
                Animation.Update();
                DrawBounds = Animation.CurrentFrameRect;
                //DrawSize = _Animations[CurrentAnimation].CurrentFrameRect;
            }
        }
示例#5
0
文件: Virus.cs 项目: Wydra/LD24
        private void BirthChild(SceneGraph graph)
        {
            if (Energy >= GameStats.ChildEnergyCost)
            {
                if (!birthSoundPlayed)
                {
                    SoundManager.PlaySound(GameAssets.BirthSound, Position, 1F);
                    birthSoundPlayed = true;
                }

                Virus childVirus = Virus.Build();
                childVirus.VirusMode = Mode.Infecting;
                childVirus.InfectedCell = this.InfectedCell;

                Vector2 childPosition = InfectedCell.Position;
                Vector2 offset = GetRandomOffsetWithinBounds(InfectedCell.DrawBounds);

                childVirus.Position = InfectedCell.Position + offset;

                graph.Add(childVirus);
                Energy = 0;
            }
        }
示例#6
0
文件: Virus.cs 项目: Wydra/LD24
        public override void Update(SceneGraph graph)
        {
            birthSoundPlayed = false;
            this.Speed = GameStats.VirusSpeed;

            base.Update(graph);

            if (VirusMode == Mode.Free)
            {
                if (Velocity != Vector2.Zero)
                {
                    Rotate();
                    if (IsPlayer)
                    {
                        ApplyFriction();
                    }
                }
            }
            else if (VirusMode == Mode.Infecting)
            {
                ticks++;
                if (ticks % 100 == 0)
                {
                    ticks = 0;
                    DrainEnergy();
                    BirthChild(graph);
                    Scatter();
                }
            }
            else if (VirusMode == Mode.Dead)
            {
                if (DeathCounter > 0)
                {
                    DeathCounter--;
                    Tint = new Color(Tint.R, Tint.G, Tint.B, DeathCounter);
                }
                else
                {
                    graph.Remove(this);
                }
            }

            if (IsImmune)
            {
                ImmunityTicks++;

                if (ImmunityTicks >= ImmunityCounter)
                {
                    IsImmune = false;
                    this.Tint = Color.White;
                }
                else
                {
                    this.Tint = Color.Red;
                }
            }
        }
示例#7
0
        public void Initialize()
        {
            SceneGraph = new SceneGraph(Map, Camera);

            DebugHud = new DebugHud(new Vector2(16, 16), GameAssets.FontArial, Color.Black, Color.Black, Color.Black);

            EvoModal = EvolutionModal.Build();

            SeedLevel(Map);

            SoundManager.PlayMusic();
        }