Example #1
0
File: Virus.cs Project: Wydra/LD24
        public override void OnCollision(Sprite caller)
        {
            if (VirusMode == Mode.Free)
            {
                base.OnCollision(caller);

                if (caller.Type == SpriteType.Cell)
                {
                    Cell callerCell = caller as Cell;
                    if (callerCell.State != Cell.CellState.Dead)
                    {
                        this.Velocity = Vector2.Zero;
                        this.Position = caller.Position;
                        this.InfectedCell = callerCell;
                        this.VirusMode = Mode.Infecting;
                    }
                }
                else if (caller.Type == SpriteType.TCell)
                {
                    Wound();

                    if (VirusMode == Mode.Dead)
                    {
                        this.Velocity = Vector2.Zero;
                        this.Position = caller.Position;
                        Vector2 offset = GetRandomOffsetWithinBounds(caller.DrawBounds);
                        this.Position += offset;
                    }
                }
                else if (caller.Type == SpriteType.Antigen)
                {
                    Wound();
                }
            }
        }
Example #2
0
File: Virus.cs Project: Wydra/LD24
 private void Scatter()
 {
     if (InfectedCell.State == Cell.CellState.Dead)
     {
         this.InfectedCell = null;
         this.VirusMode = Mode.Free;
         this.Velocity = RNG.RandomUnitVector();
         if (GameStats.FlagQuickness)
         {
             this.Velocity = this.Velocity * 3;
         }
     }
 }