private void ApplyExplodeForce(Virus virus) { float radius = Body.FixtureList.First().Shape.Radius; Vector2 force, direction; force = direction = virus.Position - this.Position; direction.Normalize(); force /= radius * 2; force += direction / 2; virus.Body.ApplyForce(force * FORCE_FACTOR); }
public bool VirusCollide(Virus virus) { _virusResistance--; if (_virusResistance == 0) { PlayWindow.LastGoodCellPosition = Position; _infected = true; _virusList.Add(virus); return(true); } else { return(false); } }
public void ExplodeByVirus() { float radius = Body.FixtureList.First().Shape.Radius; for (int i = 0; i < 1 + _virusList.Count; i++) { Vector2 position; position.X = this.Position.X - radius / 2 + (float)Shared.Random.NextDouble() * radius; position.Y = this.Position.Y - radius / 2 + (float)Shared.Random.NextDouble() * radius; Virus newVirus = new Virus(PlayWindow, position); PlayWindow.RegisterVirus(newVirus); ApplyExplodeForce(newVirus); } foreach (var item in _virusList) { PlayWindow.RemoveVirus(item); } PlayWindow.RemoveGoodCell(this); }
private void HandleEnemy(Point currentPoint, Color dotColor, Color[] colorData, Level level) { Point position = GetCenterPoint(currentPoint, dotColor, colorData); Virus virus = new Virus(PlayWindow, PointToPosition(position)); level.AddEnemy(virus); }
public bool VirusCollide(Virus virus) { _virusResistance--; if (_virusResistance == 0) { PlayWindow.LastGoodCellPosition = Position; _infected = true; _virusList.Add(virus); return true; } else return false; }
private void SpawnCenterJoint(Virus virus) { }
public void RemoveVirus(Virus virus) { _removeList.Add(virus); VirusList.Remove(virus); virus.UpForRemoval = true; }
public void RegisterVirus(Virus virus) { _addList.Add(virus); }
public void KillVirus(Virus virus) { RemoveVirus(virus); _statsHandler.RegisterDeath(virus.GetType()); }
private void DroppedVirus() { _grabbedVirus.Dropped(); _grabbedVirus = null; _outerBodyWatch.Reset(); RemoveVirusSprings(); }
private bool AABBVirusHandCollision(Fixture f) { Object o = f.Body.UserData; if (o is Virus) { Virus virus = (Virus)o; if (virus.IsNormal()) _grabbedVirus = (Virus)o; } return true; }