public void ProcessGamePad(ScreenPad screenPad, PhysicalObject gameMap) { //var candidatePos = this.Position; //var candidateXPos = this.Position; //var candidateYPos = this.Position; //if (Math.Abs(screenPad.LeftStick.X) + Math.Abs(screenPad.LeftStick.Y) > 0) //{ // screenPad.LeftStick.Normalize(); // candidatePos = this.Position + new Vector2(screenPad.LeftStick.X, -screenPad.LeftStick.Y) * .5f; // candidateXPos = this.Position + new Vector2(screenPad.LeftStick.X, 0) * .5f; // candidateYPos = this.Position + new Vector2(0, -screenPad.LeftStick.Y) * .5f; //} //var collisionResult = gameMap.TestCollision(this, candidatePos); //var collisionXResult = gameMap.TestCollision(this, candidateXPos); //var collisionYResult = gameMap.TestCollision(this, candidateYPos); //if (collisionResult.CollisionType == CollisionType.None) //{ // this.Position = candidatePos; //} //else if (collisionXResult.CollisionType == CollisionType.None) //{ // this.Position = candidateXPos; //} //else if (collisionYResult.CollisionType == CollisionType.None) //{ // this.Position = candidateYPos; //} }
public View(GraphicsDeviceManager graphics, ContentManager content, ScreenPad screenPad, BossMovement bossMovement, int levelNumber, string levelName, IJsonMapManager jsonMapManager) { viewStatesDic.Add(ViewState.Intro, new ViewStateIntro(graphics, content, screenPad, bossMovement, levelNumber, levelName, jsonMapManager)); viewStatesDic.Add(ViewState.Menu, new ViewStateMenu(graphics, content, screenPad, bossMovement, levelNumber, levelName, jsonMapManager)); viewStatesDic.Add(ViewState.ShowLevel, new ViewStateShowLevel(graphics, content, screenPad, bossMovement, levelNumber, levelName, jsonMapManager)); viewStatesDic.Add(ViewState.Playing, new ViewStatePlaying(graphics, content, screenPad, bossMovement, levelNumber, levelName, jsonMapManager)); viewStatesDic.Add(ViewState.TheEnd, new ViewStateTheEnd(graphics, content, screenPad, bossMovement, levelNumber, levelName, jsonMapManager)); viewStatesDic.Add(ViewState.GameOver, new ViewStateGameOver(graphics, content, screenPad, bossMovement, levelNumber, levelName, jsonMapManager)); currentViewState = viewStatesDic[ViewState.Menu]; NewMessenger.Default.Register <ViewStateChangedMessage>(this, (message) => { foreach (var viewState in viewStatesDic.Values) { viewState.UnregisterActions(); } currentViewState = viewStatesDic[message.ViewState]; currentViewState.RegisterActions(); if (message.ViewState == ViewState.Intro) { currentViewState.InitializeLevel(); } }); }
public void ProcessGamePad(ScreenPad screenPad, PhysicalObject gameMap, float scrollRows) { var candidatePos = this.Position; var candidateXPos = this.Position; var candidateYPos = this.Position; if (Math.Abs(screenPad.LeftStick.X) + Math.Abs(screenPad.LeftStick.Y) > 0) { screenPad.LeftStick.Normalize(); candidatePos = this.Position + new Vector2(screenPad.LeftStick.X, -screenPad.LeftStick.Y) * .25f; candidateXPos = this.Position + new Vector2(screenPad.LeftStick.X, 0) * .25f; candidateYPos = this.Position + new Vector2(0, -screenPad.LeftStick.Y) * .25f; } var collisionResult = gameMap.TestCollision(this, candidatePos, scrollRows); var collisionXResult = gameMap.TestCollision(this, candidateXPos, scrollRows); var collisionYResult = gameMap.TestCollision(this, candidateYPos, scrollRows); if (collisionResult.CollisionType == CollisionType.None) { this.Position = candidatePos; } else if (collisionXResult.CollisionType == CollisionType.None) { this.Position = candidateXPos; } else if (collisionYResult.CollisionType == CollisionType.None) { this.Position = candidateYPos; } }
public PlayerBullet(ContentManager content, SpriteBatch spriteBatch, Vector2 deviceScreenSize, ScreenPad screenPad, float damage, Player player) : base(content, spriteBatch, deviceScreenSize, screenPad, damage) { Size = new Vector2(2, 2); speed = .4f; this.damage = damage; this.player = player; this.screenPad = screenPad; direction = new Vector2(0, -1); }
public PhysicalObject(ContentManager content, SpriteBatch spriteBatch, Vector2 deviceScreenSize, ScreenPad screenPad) { SetNewContent(content); this.spriteBatch = spriteBatch; this.deviceScreenSize = deviceScreenSize; this.screenPad = screenPad; this.TopLeftCorner = new Vector2((deviceScreenSize.X - gameScreenTilesSize.X * tileWidth) / 2, (deviceScreenSize.Y - gameScreenTilesSize.Y * tileWidth) / 2); font = font ?? ContentHelper.Instance.GetContent <SpriteFont>("Super-Contra-NES"); LoadContent(); }
private void ConfigureScreenPad() { gameFrameTexture = ContentHelper.Instance.GetContent <Texture2D>("GameFrame"); screenPad = new ScreenPad ( this, Content ); Resolver.Instance.RegisterGame(Content, screenPad); }
public ViewStateBase(GraphicsDeviceManager graphics, ContentManager content, ScreenPad screenPad, BossMovement bossMovement, int levelNumber, string levelName, IJsonMapManager jsonMapManager) { this.content = content; this.graphics = graphics; this.content = content; this.screenPad = BaseResolver.Instance.Resolve <IScreenPad>(); this.levelNumber = levelNumber; this.levelName = levelName; this.topLeftCorner = new Vector2((screenSize.X - gameScreenSize.X) / 2, (screenSize.Y - gameScreenSize.Y) / 2); this.jsonMapManager = jsonMapManager; camera2d = BaseResolver.Instance.Resolve <ICamera2d>(); DefineActions(); }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { gameFrameTexture = ContentHelper.Instance.GetContent <Texture2D>("GameFrame"); // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); screenPad = new ScreenPad ( this, ContentHelper.Instance.GetContent <Texture2D>("ThumbBase"), ContentHelper.Instance.GetContent <Texture2D>("ThumbStick"), ContentHelper.Instance.GetContent <Texture2D>("ABXY_buttons") ); PassLevel(); }
/////////////////////////////////////////////////////////////////////////////// // functions /////////////////////////////////////////////////////////////////////////////// // ------------------------------------------------------------------ // Desc: // ------------------------------------------------------------------ void Awake () { screenPad = GetComponent<ScreenPad>(); this.initBoyTrans = boyFace.transform; this.initGirlTrans = girlFace.transform; // this.showHideInitPos = new Vector3[ShowHideControls.Length]; for ( int i = 0; i < ShowHideControls.Length; ++i ) { showHideInitPos[i] = ShowHideControls[i].transform.localPosition; Vector3 offset = showHideInitPos[i].normalized * 400.0f; ShowHideControls[i].transform.localPosition = new Vector3( showHideInitPos[i].x + offset.x, showHideInitPos[i].y + offset.y, showHideInitPos[i].z ); } }
private void PassLevel() { levelIndex++; BossMovement[] bossMovements = new BossMovement[] { BossMovement.WalkHorizontal, BossMovement.FloatSenoidHorizontal, BossMovement.WalkHorizontal, BossMovement.FloatSenoidHorizontal, BossMovement.WalkHorizontal, BossMovement.WalkHorizontal, BossMovement.WalkHorizontal, BossMovement.WalkHorizontal }; string[] levelNames = new string[] { "MEDUSA", "THANATOS", "HYDRA", "CYCLOPS", "AUTOMATON", "GIANT", "MINOTAUR", "ARGUS" }; if (currentView != null) { currentView.UnregisterActions(); currentView.UnloadContent(); Content.RootDirectory = "Content"; ContentHelper.Setup(Content); gameFrameTexture = ContentHelper.Instance.GetContent <Texture2D>("GameFrame"); screenPad = new ScreenPad ( this, ContentHelper.Instance.GetContent <Texture2D>("ThumbBase"), ContentHelper.Instance.GetContent <Texture2D>("ThumbStick"), ContentHelper.Instance.GetContent <Texture2D>("ABXY_buttons") ); } currentView = new View(graphics, spriteBatch, Content, screenPad, bossMovements[levelIndex], levelIndex + 1, levelNames[levelIndex]); currentView.RegisterActions(); }
public Enemy12(ContentManager content, SpriteBatch spriteBatch, Vector2 deviceScreenSize, ScreenPad screenPad, Vector2 position, int groupId) : base(content, spriteBatch, deviceScreenSize, screenPad, position, groupId) { charCode = 'l'; Size = new Vector2(2, 2); Speed = 1f; Position = position; Lives = 1000; IsPassingBy = true; IsFlying = true; Direction = new Vector2(position.X < windowTilesSize.X / 2 ? -1 : 1, 0); }
public Enemy13(ContentManager content, SpriteBatch spriteBatch, Vector2 deviceScreenSize, ScreenPad screenPad, Vector2 position, int groupId) : base(content, spriteBatch, deviceScreenSize, screenPad, position, groupId) { charCode = 'm'; Size = new Vector2(2, 2); Speed = 3f; Position = position; }
public Enemy4(ContentManager content, SpriteBatch spriteBatch, Vector2 deviceScreenSize, ScreenPad screenPad, Vector2 position, int groupId) : base(content, spriteBatch, deviceScreenSize, screenPad, position, groupId) { charCode = 'd'; Size = new Vector2(2, 2); Speed = 3f; Position = position; rangeWidth = .125f; ticksToYRate = 10; }
public Enemy7(ContentManager content, SpriteBatch spriteBatch, Vector2 deviceScreenSize, ScreenPad screenPad, Vector2 position, int groupId) : base(content, spriteBatch, deviceScreenSize, screenPad, position, groupId) { charCode = 'g'; Size = new Vector2(2, 2); Speed = 2f; Position = position; IsPassingBy = false; }
public Weapon(ContentManager content, SpriteBatch spriteBatch, Vector2 deviceScreenSize, ScreenPad screenPad, Vector2 position, Player player) : base(content, spriteBatch, deviceScreenSize, screenPad) { Size = new Vector2(2, 2); StartPosition = Position = position; this.player = player; }
public Enemy(ContentManager content, SpriteBatch spriteBatch, Vector2 deviceScreenSize, ScreenPad screenPad, Vector2 position, int groupId) : base(content, spriteBatch, deviceScreenSize, screenPad) { Size = new Vector2(2, 2); StartPosition = Position = position; this.groupId = groupId; }
public Player(ContentManager content, SpriteBatch spriteBatch, Vector2 deviceScreenSize, ScreenPad screenPad) : base(content, spriteBatch, deviceScreenSize, screenPad) { }
public Bonus(ContentManager content, SpriteBatch spriteBatch, Vector2 deviceScreenSize, ScreenPad screenPad, Vector2 position, Char bonusCode) : base(content, spriteBatch, deviceScreenSize, screenPad) { Size = new Vector2(2, 2); Position = position; this.bonusCode = bonusCode; switch (bonusCode) { case 'A': interMediateState = BonusState.FiveHundredPoints; break; case 'B': interMediateState = BonusState.Freeze; break; case 'C': interMediateState = BonusState.ExtraLife; break; case 'D': interMediateState = BonusState.Barrier; break; case 'E': interMediateState = BonusState.KillAllInScreen; break; } }
public Princess(ContentManager content, SpriteBatch spriteBatch, Vector2 deviceScreenSize, ScreenPad screenPad) : base(content, spriteBatch, deviceScreenSize, screenPad) { Position = new Vector2(windowTilesSize.X / 2 - Size.X / 2, 3); }
public PlayerBullet5(ContentManager content, SpriteBatch spriteBatch, Vector2 deviceScreenSize, ScreenPad screenPad, float damage, Player player, Vector2 direction, float rotation, bool shouldPlaySound) : base(content, spriteBatch, deviceScreenSize, screenPad, damage, player) { this.direction = direction; this.rotation = rotation; this.shouldPlaySound = shouldPlaySound; }
public PlayerBullet6(ContentManager content, SpriteBatch spriteBatch, Vector2 deviceScreenSize, ScreenPad screenPad, float damage, Player player) : base(content, spriteBatch, deviceScreenSize, screenPad, damage, player) { speed = 20f; }
/////////////////////////////////////////////////////////////////////////////// // functions /////////////////////////////////////////////////////////////////////////////// // ------------------------------------------------------------------ // Desc: // ------------------------------------------------------------------ void Awake () { if( instance == null ) { instance = this; // check if we have main menu options, and apply the options. GameObject options = GameObject.Find("MainMenuOptions"); if ( options ) { instance.multiPlayer = options.GetComponent<MainMenuOptions>().isMultiPlayer; Debug.Log("multi player = " + instance.multiPlayer ); GameObject.Destroy(options); } // GameObject goBoy = GameObject.FindWithTag("player_boy"); playerBoy = goBoy.GetComponent<PlayerBase>(); GameObject goGirl = GameObject.FindWithTag("player_girl"); playerGirl = goGirl.GetComponent<PlayerBase>(); // if ( startPoints.Length != 0 ) { int i = (int)(Random.value * (startPoints.Length-1)); PlacePlayerAtStartPoint(this.startPoints[i].transform); } else { Debug.LogError("Can't find start point"); } // init hud if ( screenPad == null ) { GameObject hud = null; hud_m.SetActiveRecursively(false); hud_s.SetActiveRecursively(false); if ( Game.IsMultiPlayer() ) hud = hud_m; else hud = hud_s; hud.SetActiveRecursively(true); if ( hud ) { screenPad = hud.GetComponent<ScreenPad>(); screenPad.Init(); } #if UNITY_IPHONE if ( Application.isEditor == false ) { DebugHelper.Assert( screenPad, "screenPad not found" ); } #endif } } }
public Map(ContentManager content, SpriteBatch spriteBatch, Vector2 deviceScreenSize, ScreenPad screenPad, int levelNumber) : base(content, spriteBatch, deviceScreenSize, screenPad) { scrollRows = scrollStartRow; this.levelNumber = levelNumber; LoadMapContent(); using (var sr = new StreamReader(string.Format(@"Content\Map{0:d2}.txt", levelNumber))) { var line = string.Empty; var y = 0; while ((line = sr.ReadLine()) != null) { mapLines.Add(line); } } scrollStartRow = (int)(mapLines.Count() * 2 - windowTilesSize.Y); }
public EnemyBullet3(ContentManager content, SpriteBatch spriteBatch, Vector2 deviceScreenSize, ScreenPad screenPad, Vector2 position, int groupId) : base(content, spriteBatch, deviceScreenSize, screenPad, position, groupId) { Size = new Vector2(2, 2); Speed = 5f; Position = position; IsBullet = true; }
public Bullet(ContentManager content, SpriteBatch spriteBatch, Vector2 deviceScreenSize, ScreenPad screenPad, float damage) : base(content, spriteBatch, deviceScreenSize, screenPad) { Size = new Vector2(2, 2); this.damage = damage; soundEffectInstance.Volume = .6f; }
public ViewStateTheEnd(GraphicsDeviceManager graphics, ContentManager content, ScreenPad screenPad, BossMovement bossMovement, int levelNumber, string levelName, IJsonMapManager jsonMapManager) : base(graphics, content, screenPad, bossMovement, levelNumber, levelName, jsonMapManager) { }
public Boss(ContentManager content, SpriteBatch spriteBatch, Vector2 deviceScreenSize, ScreenPad screenPad, Vector2 windowTilesSize, int levelNumber, BossMovement bossMovement) : base(content, spriteBatch, deviceScreenSize, screenPad) { this.windowTilesSize = windowTilesSize; this.levelNumber = levelNumber; this.bossMovement = bossMovement; bossSpriteSheet = bossSpriteSheet ?? GetTexture(string.Format("Boss{0}SpriteSheet", levelNumber)); bossHitSpriteSheet = bossHitSpriteSheet ?? GetTexture(string.Format("Boss{0}HitSpriteSheet", levelNumber)); }