Esempio n. 1
0
File: Cell.cs Progetto: 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);
                }
            }
        }
Esempio n. 2
0
File: Virus.cs Progetto: 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;
                }
            }
        }