public void Awake() { _spriteStates = new Dictionary<GoalkeeperState, Vector3>(); _random = new SystemRandom(DateTime.Now.Millisecond); // Get the transform and renderer; _transform = GetComponent<Transform>(); _renderer = GetComponent<SpriteRenderer>(); // Get the zones. _leftZone = GameObject.Find("Left-Zone").GetComponent<GoalZone>(); _centerZone = GameObject.Find("Center-Zone").GetComponent<GoalZone>(); _rightZone = GameObject.Find("Right-Zone").GetComponent<GoalZone>(); // Get the ball. _ball = GameObject.Find("Ball").GetComponent<Ball>(); // Initialize all sprite states. _spriteStates.Add(GoalkeeperState.Playing, new Vector3(0, 0, 0)); _spriteStates.Add(GoalkeeperState.CatchLeft, new Vector3(-4, 0, 0)); _spriteStates.Add(GoalkeeperState.CatchRight, new Vector3(4, 0, 0)); _spriteStates.Add(GoalkeeperState.CatchCenter, new Vector3(0, 0, 0)); _spriteStates.Add(GoalkeeperState.MissLeft, new Vector3(-4, 0, 0)); _spriteStates.Add(GoalkeeperState.MissCenter, new Vector3(0, 0, 0)); _spriteStates.Add(GoalkeeperState.MissRight, new Vector3(4, 0, 0)); // Set the default state. SetGoalkeeperState(GoalkeeperState.Playing); }
public override void LoadLevel() { base.LoadLevel(); Sprite3 newPlatform; //DASH LEVEL OutOfBounds = new Rectangle(-100, 0, 7000, 1000); ////debug //newPlatform = new Sprite3(true, texPixel, 0, 700); //newPlatform.setWidthHeight(7000, 30); //platformList.addSpriteReuse(newPlatform); //start platform newPlatform = new Sprite3(true, texPixel, 200, 600); newPlatform.setWidthHeight(100, 30); platformList.addSpriteReuse(newPlatform); PlayerSpawnPosition = new Vector2(newPlatform.getBoundingBoxAA().X + newPlatform.getBoundingBoxAA().Width / 2 - player.getWidth() / 2, newPlatform.getBoundingBoxAA().Y - 100); newPlatform = new Sprite3(true, texPixel, 3000, 600); newPlatform.setWidthHeight(300, 30); platformList.addSpriteReuse(newPlatform); //make goal on last platform goal = new GoalZone(newPlatform); if (!isChallengeMode) { targetSpawnPositions.Add(new Vector2(512, 429)); targetSpawnPositions.Add(new Vector2(833, 422)); targetSpawnPositions.Add(new Vector2(1119, 424)); //targetSpawnPositions.Add(new Vector2(1430, 422)); targetSpawnPositions.Add(new Vector2(1745, 422)); //targetSpawnPositions.Add(new Vector2(2065, 422)); targetSpawnPositions.Add(new Vector2(2378, 422)); //targetSpawnPositions.Add(new Vector2(2725, 422)); } else { //ceiling newPlatform = new Sprite3(true, texPixel, 0, 400); newPlatform.setWidthHeight(7000, 30); platformList.addSpriteReuse(newPlatform); targetSpawnPositions.Add(new Vector2(512, 429)); targetSpawnPositions.Add(new Vector2(833, 422)); targetSpawnPositions.Add(new Vector2(1119, 424)); targetSpawnPositions.Add(new Vector2(1430, 422)); targetSpawnPositions.Add(new Vector2(1745, 422)); targetSpawnPositions.Add(new Vector2(2065, 422)); targetSpawnPositions.Add(new Vector2(2378, 422)); targetSpawnPositions.Add(new Vector2(2725, 422)); targetSpawnPositions.Add(new Vector2(2992, 422)); } }
public override void LoadLevel() { base.LoadLevel(); Sprite3 newPlatform; //PIT LEVEL. OutOfBounds = new Rectangle(-100, 0, Game1.SCREEN_WIDTH + 100, 1000); //ceiling newPlatform = new Sprite3(true, texPixel, 0, 0); newPlatform.setWidthHeight(2000, 30); platformList.addSpriteReuse(newPlatform); //start platform newPlatform = new Sprite3(true, texPixel, PlayerSpawnPosition.X - player.getWidth(), PlayerSpawnPosition.Y + 100); newPlatform.setWidthHeight(150, 30); platformList.addSpriteReuse(newPlatform); //wall blocking way newPlatform = new Sprite3(true, texPixel, 500, 0); newPlatform.setWidthHeight(30, 500); platformList.addSpriteReuse(newPlatform); //goalplatform newPlatform = new Sprite3(true, texPixel, 700, PlayerSpawnPosition.Y + 100); newPlatform.setWidthHeight(150, 30); platformList.addSpriteReuse(newPlatform); if (!isChallengeMode) { //EASY PIT LEVEL targetSpawnPositions.Add(new Vector2(368, 175)); targetSpawnPositions.Add(new Vector2(360, 316)); targetSpawnPositions.Add(new Vector2(346, 448)); targetSpawnPositions.Add(new Vector2(337, 594)); targetSpawnPositions.Add(new Vector2(468, 592)); targetSpawnPositions.Add(new Vector2(592, 590)); targetSpawnPositions.Add(new Vector2(587, 479)); targetSpawnPositions.Add(new Vector2(580, 358)); targetSpawnPositions.Add(new Vector2(583, 243)); targetSpawnPositions.Add(new Vector2(590, 149)); } else { //TAEWOOKS LEVEL targetSpawnPositions.Add(new Vector2(736, 459)); targetSpawnPositions.Add(new Vector2(1039, 574)); targetSpawnPositions.Add(new Vector2(910, 389)); targetSpawnPositions.Add(new Vector2(83, 711)); targetSpawnPositions.Add(new Vector2(509, 599)); targetSpawnPositions.Add(new Vector2(577, 298)); targetSpawnPositions.Add(new Vector2(577, 180)); } //make goal on platform // goal = new GoalZone(new Vector2(700, PlayerSpawnPosition.Y), 100, 100); goal = new GoalZone(newPlatform); }
public override void LoadLevel() { Sprite3 newPlatform; base.LoadLevel(); OutOfBounds = new Rectangle(-100, 0, 7000, 1000); //TUTORIAL START newPlatform = new Sprite3(true, texPixel, 0, 700); newPlatform.setWidthHeight(800, 30); platformList.addSpriteReuse(newPlatform); //pit between these two newPlatform = new Sprite3(true, texPixel, 1700, 700); newPlatform.setWidthHeight(2000, 30); platformList.addSpriteReuse(newPlatform); //the double jump test. player has to hold A on one or both of the jumps to pass. newPlatform = new Sprite3(true, texPixel, 500, 500); newPlatform.setWidthHeight(30, 200); platformList.addSpriteReuse(newPlatform); //tutorial target targetSpawnPositions.Add(new Vector2(2051, 507)); //High wall newPlatform = new Sprite3(true, texPixel, 2551, 300); newPlatform.setWidthHeight(30, 400); platformList.addSpriteReuse(newPlatform); //targets to make the high wall targetSpawnPositions.Add(new Vector2(2432, 587)); targetSpawnPositions.Add(new Vector2(2427, 493)); targetSpawnPositions.Add(new Vector2(2427, 389)); targetSpawnPositions.Add(new Vector2(2430, 300)); targetSpawnPositions.Add(new Vector2(2436, 196)); //----------- newPlatform = new Sprite3(true, texPixel, 3000, 700); newPlatform.setWidthHeight(800, 30); platformList.addSpriteReuse(newPlatform); //bigger target pit newPlatform = new Sprite3(true, texPixel, 4850, 700); newPlatform.setWidthHeight(3000, 30); platformList.addSpriteReuse(newPlatform); //tutorial target. respawn? targetSpawnPositions.Add(new Vector2(4274, 463)); //checkpoint targetSpawnPositions.Add(new Vector2(3527, 627)); //goalPlatform Sprite3 goalPlatform = new Sprite3(true, texPixel, 5150, 700); goalPlatform.setWidthHeight(100, 30); platformList.addSpriteReuse(goalPlatform); goal = new GoalZone(goalPlatform); //Wall behind goal newPlatform = new Sprite3(true, texPixel, 5350, -10); newPlatform.setWidthHeight(800, 900); platformList.addSpriteReuse(newPlatform); }
public override void LoadLevel() { base.LoadLevel(); Sprite3 newPlatform; //PIT LEVEL. OutOfBounds = new Rectangle(-100, 0, Game1.SCREEN_WIDTH + 100, 1000); newPlatform = new Sprite3(true, texPixel, 200, 600); newPlatform.setWidthHeight(100, 30); platformList.addSpriteReuse(newPlatform); PlayerSpawnPosition = new Vector2(newPlatform.getBoundingBoxAA().X + newPlatform.getBoundingBoxAA().Width / 2 - player.getWidth() / 2, newPlatform.getBoundingBoxAA().Y - 100); targetSpawnPositions.Add(new Vector2(135, 79)); targetSpawnPositions.Add(new Vector2(411, 53)); targetSpawnPositions.Add(new Vector2(295, 295)); targetSpawnPositions.Add(new Vector2(270, 145)); targetSpawnPositions.Add(new Vector2(515, 376)); targetSpawnPositions.Add(new Vector2(484, 213)); targetSpawnPositions.Add(new Vector2(123, 461)); targetSpawnPositions.Add(new Vector2(164, 246)); targetSpawnPositions.Add(new Vector2(400, 502)); targetSpawnPositions.Add(new Vector2(399, 368)); targetSpawnPositions.Add(new Vector2(701, 511)); targetSpawnPositions.Add(new Vector2(562, 461)); targetSpawnPositions.Add(new Vector2(642, 261)); targetSpawnPositions.Add(new Vector2(907, 494)); targetSpawnPositions.Add(new Vector2(730, 381)); targetSpawnPositions.Add(new Vector2(628, 93)); targetSpawnPositions.Add(new Vector2(839, 52)); targetSpawnPositions.Add(new Vector2(945, 378)); targetSpawnPositions.Add(new Vector2(819, 201)); targetSpawnPositions.Add(new Vector2(847, 410)); targetSpawnPositions.Add(new Vector2(976, 200)); targetSpawnPositions.Add(new Vector2(1082, 499)); targetSpawnPositions.Add(new Vector2(1077, 293)); newPlatform = new Sprite3(true, texPixel, 1100, 150); newPlatform.setWidthHeight(100, 30); platformList.addSpriteReuse(newPlatform); //make goal on platform // goal = new GoalZone(new Vector2(700, PlayerSpawnPosition.Y), 100, 100); goal = new GoalZone(newPlatform); player.LoadPlatformsPlayer(platformList); }
public override void LoadLevel() { Game1.TimeScore = 0; base.LoadLevel(); Sprite3 newPlatform; OutOfBounds = new Rectangle(0, 0, Game1.SCREEN_WIDTH, 1000); newPlatform = new Sprite3(true, texPixel, 200, 500); newPlatform.setWidthHeight(100, 30); platformList.addSpriteReuse(newPlatform); PlayerSpawnPosition = new Vector2(newPlatform.getBoundingBoxAA().X + newPlatform.getBoundingBoxAA().Width / 2 - player.getWidth() / 2, newPlatform.getBoundingBoxAA().Y - 100); newPlatform = new Sprite3(true, texPixel, 900, 500); newPlatform.setWidthHeight(100, 30); platformList.addSpriteReuse(newPlatform); if (!isChallengeMode) { targetSpawnPositions.Add(new Vector2(380, 362)); targetSpawnPositions.Add(new Vector2(552, 359)); targetSpawnPositions.Add(new Vector2(717, 354)); } else { targetSpawnPositions.Add(new Vector2(74, 396)); targetSpawnPositions.Add(new Vector2(69, 537)); targetSpawnPositions.Add(new Vector2(70, 682)); targetSpawnPositions.Add(new Vector2(272, 675)); targetSpawnPositions.Add(new Vector2(471, 664)); targetSpawnPositions.Add(new Vector2(668, 656)); targetSpawnPositions.Add(new Vector2(850, 654)); targetSpawnPositions.Add(new Vector2(1018, 647)); targetSpawnPositions.Add(new Vector2(1158, 650)); targetSpawnPositions.Add(new Vector2(1144, 545)); targetSpawnPositions.Add(new Vector2(1144, 420)); } goal = new GoalZone(newPlatform); }
public override void LoadLevel() { base.LoadLevel(); Sprite3 newPlatform; OutOfBounds = new Rectangle(0, 0, Game1.SCREEN_WIDTH, 1000); platformList = new SpriteList(); newPlatform = new Sprite3(true, texPixel, 200, 700); newPlatform.setWidthHeight(100, 30); platformList.addSpriteReuse(newPlatform); targetSpawnPositions = new List <Vector2>(); PlayerSpawnPosition = new Vector2(newPlatform.getBoundingBoxAA().X + newPlatform.getBoundingBoxAA().Width / 2 - player.getWidth() / 2, newPlatform.getBoundingBoxAA().Y - 100); newPlatform = new Sprite3(true, texPixel, 700, 150); newPlatform.setWidthHeight(100, 30); platformList.addSpriteReuse(newPlatform); if (!isChallengeMode) { targetSpawnPositions.Add(new Vector2(280, 586)); targetSpawnPositions.Add(new Vector2(325, 487)); targetSpawnPositions.Add(new Vector2(367, 394)); targetSpawnPositions.Add(new Vector2(414, 294)); targetSpawnPositions.Add(new Vector2(469, 188)); targetSpawnPositions.Add(new Vector2(526, 82)); } else { targetSpawnPositions.Add(new Vector2(68, 608)); targetSpawnPositions.Add(new Vector2(68, 497)); targetSpawnPositions.Add(new Vector2(67, 399)); targetSpawnPositions.Add(new Vector2(72, 293)); targetSpawnPositions.Add(new Vector2(79, 185)); targetSpawnPositions.Add(new Vector2(78, 90)); } goal = new GoalZone(newPlatform); player.LoadPlatformsPlayer(platformList); }
void shootBallOut() { var actor = ball.owner; FixVector3 ballStartPosition = getActorShootOutPosition(actor, actor.shootingType); FixVector2 frontPosition = new FixVector2(ballStartPosition.x, ballStartPosition.z); Fix64 maxPassSpeed = actor.configuration.maxGoalSpeed[(int)actor.shootingType]; Fix64 rightDoorV = actor.team == FBTeam.kBlue ? new Fix64(1) : new Fix64(-1); GoalZone zone = config.getGoalZone((int)actor.shootingType, (int)actor.configuration.sb_ShootBallZone[(int)actor.shootingType]); //随机位置 FixVector2 targetPosition = new FixVector2(config.worldSize.x * rightDoorV, zone.center.x * positiveDoorSide); targetPosition += new FixVector2 { x = config.doorHalfSize.x * new Fix64(2) * randomUnit, y = zone.halfSize.x * (randomUnit - (Fix64)0.5f) }; //Debuger.Log("targetPosition:" + targetPosition); FixVector2 kickBallDirection = (targetPosition - frontPosition).normalized; Fix64 needTime = Fix64.Zero; Fix64 angle = Fix64.Zero; if (actor.shootingType == ShootType.Super) { Fix64 a = (targetPosition - frontPosition).length / new Fix64(2); Fix64 c = actor.configuration.curveBallRadius; if (c <= a) { angle = actor.configuration.curveBallMaxAngle; } else { Fix64 b = Fix64.Sqrt(c * c - a * a); angle = Fix64.Atan2(a, b); if (Fix64.FastAbs(angle) > actor.configuration.curveBallMaxAngle) { angle = actor.configuration.curveBallMaxAngle; } } FixVector2 m = FixVector2.kZero - new FixVector2(config.worldSize.x * rightDoorV, Fix64.Zero); FixVector2 n = targetPosition - new FixVector2(config.worldSize.x * rightDoorV, Fix64.Zero); Fix64 cross_mn = FixVector2.cross(m, n); Fix64 angleDir = Fix64.Zero; if (cross_mn == Fix64.Zero) { angleDir = actor.configuration.defautKickBallFoot == 0 ? Fix64.One : -Fix64.One; } else if (cross_mn > Fix64.Zero) { angleDir = -Fix64.One; } else { angleDir = Fix64.One; } angle = angle * angleDir; } bool canShoot = BallParticle.calculateTime(frontPosition , targetPosition , maxPassSpeed , ball.configuration.dampingAcceleration_air , angle , out needTime); Fix64 goalHeight = Fix64.Zero; if (!canShoot) { ball.freeByKick(ballStartPosition, kickBallDirection * maxPassSpeed, maxPassSpeed, false); } else { //随机高度 goalHeight = zone.center.y + zone.halfSize.y * (randomUnit - (Fix64)0.5); ball.freeBySuperShoot(ballStartPosition, targetPosition, goalHeight, needTime, angle); } FBActor doorKeeper = getDoorKeeper(actor.team == FBTeam.kBlue ? FBTeam.kRed : FBTeam.kBlue); if (doorKeeper != null && doorKeeper != actor) { doorKeeperCathingBall(actor, doorKeeper); } onShootBallOut(actor, ball.get3DVelocity(), angle, new FixVector3 { x = targetPosition.x, y = goalHeight, z = targetPosition.y }); }
public FlyingState() : base(GameStateID.Flying) { goalZone = FindObjectOfType(typeof(GoalZone)) as GoalZone; }