protected AbstractFractionController(float interval, GDGameScreen owner, Cannon cannon, Fraction fraction) { updateInterval = interval; Cannon = cannon; Fraction = fraction; Owner = owner; }
public NeutralKIController(GDGameScreen owner, Cannon cannon, Fraction fraction) : base(NEUTRAL_UPDATE_TIME, owner, cannon, fraction) { intelligence = new List<Func<GameEntity>> { FindTargetAttackingBullet }; }
public Bullet(GameScreen scrn, Cannon shooter, Vector2 pos, Vector2 velo, float entityScale) : base(scrn) { BulletPosition = pos; initialVelocity = velo; Source = shooter; Fraction = Source.Fraction; Scale = entityScale; DrawingBoundingBox = new FSize(BULLET_DIAMETER, BULLET_DIAMETER); }
public StandardKIController(GDGameScreen owner, Cannon cannon, Fraction fraction) : base(STANDARD_UPDATE_TIME, owner, cannon, fraction) { intelligence = new List<Func<GameEntity>> { FindTargetAttackingBullet, FindTargetSupportCannon, FindTargetNeutralCannon, FindTargetEnemyCannon, FindTargetFriendlyCannon, FindTargetBlockedEnemyCannon, FindTargetBlockedFriendlyCannon, FindNearestEnemyCannon }; }
public AbstractFractionController CreateController(GDGameScreen owner, Cannon cannon) { switch (Type) { case FractionType.PlayerFraction: if (owner.HasFinished) return new EndGameAutoPlayerController(owner, cannon, this); else return new PlayerController(owner, cannon, this); case FractionType.ComputerFraction: return new StandardKIController(owner, cannon, this); case FractionType.NeutralFraction: return new NeutralKIController(owner, cannon, this); default: throw new ArgumentOutOfRangeException(); } }
public void DeregisterBlockedSpawn(Cannon cannon, int x, int y) { blockedGridPoints[x, y].Remove(cannon); }
public void RegisterBlockedSpawn(Cannon cannon, int x, int y) { blockedGridPoints[x, y].Add(cannon); }
protected KIController(float interval, GDGameScreen owner, Cannon cannon, Fraction fraction) : base(interval, owner, cannon, fraction) { crng = new ConstantRandom(cannon); }
// ignore all bullets private bool IsBulletBlockedReachable(Cannon c) { GameEntity result = null; Func<Fixture, Vector2, Vector2, float, float> callback = (f, pos, normal, frac) => { if (f.UserData == Cannon) return -1; // ignore self; if (f.UserData == c) return frac; // limit if (f.UserData is Bullet) // ignore _all_ Bullets { return -1; // ignore } result = (GameEntity)f.UserData; return 0; // terminate }; var rayStart = Cannon.PhysicsBody.Position; var rayEnd = c.PhysicsBody.Position; Owner.GetPhysicsWorld().RayCast(callback, rayStart, rayEnd); return (result == null); }
public PlayerController(GDGameScreen owner, Cannon cannon, Fraction fraction) : base(0f, owner, cannon, fraction) { innerBoundings = new CircleF(Cannon.Center, Cannon.Scale * Cannon.CANNON_OUTER_DIAMETER / 2); }
public EmptyController(GDGameScreen owner, Cannon cannon, Fraction fraction) : base(0, owner, cannon, fraction) { }