public Plot(MotherShip m, Point center) { double x = center.X; double y = center.Y; Points = new PointCollection() { //top section new Point(x, y - 15), new Point(x + 2.5, y - 20), new Point(x, y - 20), new Point(x - 5, y - 10), new Point(x - 10, y - 10), new Point(x - 5, y - 20), new Point(x - 15, y - 20), new Point(x - 10, y - 30), new Point(x + 10, y - 30), new Point(x + 15, y - 20), new Point(x + 20, y - 20), new Point(x - 20, y - 20), new Point(x - 20, y - 10), new Point(x + 20, y - 10), new Point(x + 20, y - 20), new Point(x + 20, y - 10), //bottom right corner of viewing center new Point(x + 40, y), new Point(x - 40, y), new Point(x - 40, y + 10), new Point(x + 40, y + 10), new Point(x + 40, y), new Point(x + 40, y + 10), new Point(x + 30, y + 20), new Point(x - 30, y + 20), new Point(x + 30, y + 20), new Point(x + 35, y + 30), new Point(x + 5, y + 60), new Point(x + 25, y + 30), new Point(x + 20, y + 20), //top left point of right claw new Point(x + 10, y + 20), new Point(x + 5, y + 30), new Point(x - 5, y + 30), new Point(x + 5, y + 30), new Point(x, y + 57.5), new Point(x - 5, y + 30), new Point(x - 10, y + 20), new Point(x - 20, y + 20), new Point(x - 25, y + 30), new Point(x - 5, y + 60), new Point(x - 35, y + 30), new Point(x - 30, y + 20), new Point(x - 40, y + 10), new Point(x - 40, y), new Point(x - 20, y - 10) }; }
// Start is called before the first frame update void Start() { agent = GetComponent <NavMeshAgent>(); agent.speed = stats.Speed; childAtkRadiusObject = GetComponentInChildren <ARO>().gameObject; Rigidbody rb = GetComponent <Rigidbody>(); rb.isKinematic = true; rb.useGravity = false; HP = stats.MaxHealth; cooldown = false; pursue = false; hasTarget = false; target = null; MotherTarget = null; unitDead = new UnitEvent(); unitDead.AddListener(AIController.Instance.UnRegisterUnit); AIController.Instance.RegisterUnit(this); }
/* * Deactivates the target allowing for new targets to be selected: * * TODO: Add a flag that causes unit to pursue the target if expressly chosen by player */ private void OnTriggerExit(Collider other) { if (!unit.hasTarget) { return; } else if (unit.MotherTarget != null) { MotherShip mother = other.GetComponent <MotherShip>(); if (mother != null && mother == unit.MotherTarget) { unit.MotherTarget = null; unit.hasTarget = false; return; } } else if (unit.target != null) { Unit other_unit = other.GetComponent <Unit>(); if (other_unit != null && other_unit == unit.target) { unit.target = null; unit.hasTarget = false; other_unit.unitDead.RemoveListener(unit.TargetDead); } } }
public void KillAll() { BarrierManager.KillAll(); EnemyMatrixManager.KillAll(); ShipsManager.KillAll(); MotherShip.CommitSuicide(); }
/* * When a potential target enters range (and there is no current target) attack the target */ private void OnTriggerEnter(Collider other) { if (unit.hasTarget) { return; } MotherShip mother = other.GetComponent <MotherShip>(); if (mother != null && mother.Team == TargetTeam) { unit.MotherTarget = mother; unit.hasTarget = true; unit.AttackTarget(); return; } Unit other_unit = other.GetComponent <Unit>(); if (other_unit != null && other_unit.Team == TargetTeam) { unit.hasTarget = true; unit.target = other_unit; other_unit.unitDead.AddListener(unit.TargetDead); unit.AttackTarget(); } }
protected override void Initialize() { m_Enemies = new Enemies(this); m_Barriers = new Barriers(this, k_NumOfBarriers); try { m_Player1 = new Player(1, this); m_Player1.Initialize(); m_Player2 = new Player(2, this); m_Player2.Initialize(); } catch (Exception e) { Console.WriteLine(e); } m_MotherShip = new MotherShip(this); m_CountEnemyKills = 0; m_Graphics.PreferredBackBufferWidth = 750; m_Graphics.PreferredBackBufferHeight = 600; m_Graphics.ApplyChanges(); base.Initialize(); }
// Use this for initialization void Start() { motherShip = GameObject.Find("MotherShip").GetComponent <MotherShip>(); totResource = GameObject.Find("Game Master").GetComponent <TotalResources>(); AS = this.gameObject.GetComponent <AudioSource>(); }
public void SetTarget(MotherShip mother) { target = null; pursue = false; hasTarget = true; MotherTarget = mother; TravelTo(mother.transform.position); }
public void PresetLevel() { BarrierManager.PresetLevel(Level); MotherShip.ResetPosition(); EnemyMatrixManager.PresetLevel(Level); ShipsManager.PresetLevel(); initGameComponentsPositions(); }
void Awake() { player = GameObject.FindGameObjectWithTag("Player").transform; nav = GetComponent <NavMeshAgent>(); _motherShip = GameObject.FindGameObjectWithTag("MotherShip").GetComponent <MotherShip>(); _playerInventory = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerInventory>(); }
void Awake() { // Set up the references. player = GameObject.FindGameObjectWithTag ("Player").transform; nav = GetComponent <NavMeshAgent> (); motherShip = GameObject.Find("MotherShip").GetComponent<MotherShip>(); playerInventory = GameObject.FindGameObjectWithTag("Player").GetComponent<PlayerInventory>(); }
void Awake() { // Set up the references. player = GameObject.FindGameObjectWithTag("Player").transform; nav = GetComponent <NavMeshAgent> (); motherShip = GameObject.Find("MotherShip").GetComponent <MotherShip>(); playerInventory = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerInventory>(); }
private void Awake() { int index = Random.Range(0, obsticles.Count); var building = Instantiate(obsticles[index], transform.position + new Vector3(0, 2, 0), obsticles[index].transform.rotation); building.transform.parent = this.transform; motherShip = GetComponentInChildren <MotherShip>(); }
private void OnTriggerEnter2D(Collider2D col) { if (col.gameObject.tag == "Barrier") { Destroy(gameObject); } if (col.gameObject.tag == "Rock") { Rock _rock = col.gameObject.GetComponent <Rock>(); if (_rock != null) { _rock.TakeDamage(); Destroy(gameObject); } } if (col.gameObject.tag == "Alien") { AlienController _alienController = col.gameObject.GetComponent <AlienController>(); if (_alienController != null) { _alienController.Die(); IncreaseScore(10); Destroy(gameObject); } } if (col.gameObject.tag == "Boss") { BossController _bossController = col.gameObject.GetComponent <BossController>(); if (_bossController != null) { _bossController.TakeDamage(); IncreaseScore(5); Destroy(gameObject); } } if (col.gameObject.tag == "Ship") { MotherShip _motherShip = col.gameObject.GetComponent <MotherShip>(); if (_motherShip != null) { _motherShip.Die(); AudioManager.audioManager.PlaySound("Ship Hit"); ShipSpawnStart _shipSpawner = GameObject.FindObjectOfType <ShipSpawnStart>(); _shipSpawner.canWeSpawn = true; _shipSpawner.CreateNewSpawnRate(); IncreaseScore(50); Destroy(gameObject); } } }
void Start() { effect = GetComponent <WarpEffect>(); motherShip = GameObject.FindGameObjectWithTag("MotherShip").GetComponent <MotherShip>(); ui = GameObject.FindGameObjectWithTag("UI").GetComponent <UI>(); player = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerMovement>(); levelRoot = GameObject.FindGameObjectWithTag("Level"); fuelDropSpot = motherShip.FuelDropSpot; DisableFuelDropSpot(); }
public void AsAMotherShipIShouldAbortTheMarsRoverMissionIfThereIsInvalidDirectionForRoverPosition() { var commands = "1 1\n0 0 A"; var motherShip = new MotherShip(); motherShip.ExecuteMarsRoverMission(commands); Assert.AreEqual(Messages.RoverArgumentNullExceptionMessage, motherShip.MarsRoverMissionResult); }
public void AsAMotherShipIShouldAbortTheMarsRoverMissionIfICannotInitiateTheTerrain() { var commands = "0 1"; var motherShip = new MotherShip(); motherShip.ExecuteMarsRoverMission(commands); Assert.AreEqual(Messages.TerrainInvalidInitializationValueExceptionMessage, motherShip.MarsRoverMissionResult); }
public void AsAMotherShipIShouldAbortTheMarsRoverMissionIfThereIsNegativeYValueForRoverPosition() { var commands = "1 1\n0 -1 N"; var motherShip = new MotherShip(); motherShip.ExecuteMarsRoverMission(commands); Assert.AreEqual(Messages.RoverNegativePositionExceptionMessage, motherShip.MarsRoverMissionResult); }
public void AsAMotherShipIShouldReceiveValidTextCommandsAndExecuteTheMarsRoverMission() { var commands = "5 5\n1 2 N\nLMLMLMLMM\n3 3 E\nMMRMMRMRRM"; var expectedOutput = "1 3 N\n5 1 E"; var motherShip = new MotherShip(); motherShip.ExecuteMarsRoverMission(commands); Assert.AreEqual(expectedOutput, motherShip.MarsRoverMissionResult); }
void Start() { motherShip = GameObject.FindGameObjectWithTag("MotherShip").GetComponent <MotherShip>(); foreach (Transform child in transform) { if (child.name == "LaunchTarget") { launchTarget = child.gameObject; } } }
void Start() { barrel.transform.localEulerAngles = Vector3.zero; startPos = barrel.transform.up; chargingParticleSystem.Stop(); laserHitParticleSystem.Stop(); ParticleSystem.MainModule main = chargingParticleSystem.main; main.duration = chargingTime; chargeStarted = Time.time; chargingEmission = chargingParticleSystem.emission; motherShip = GameObject.FindGameObjectWithTag("MotherShip").GetComponent <MotherShip>(); }
public void DisEmbark(MotherShip ship) { MotherShip mother = GameManager.pickedMob.GetComponent <MotherShip>(); Init(); for (int i = 0; i < mother.embarker.Count; i++) { images[i].gameObject.SetActive(true); buttons[i].onClick.AddListener(() => mother.DisEmbark(i - 1)); } disEm = true; }
public GameManager(Game i_Game) : base(i_Game) { Level = 1; BarrierManager = new BarrierManager(i_Game, Level); EnemyMatrixManager = new EnemyMatrixManager(i_Game, Level); ShipsManager = new ShipsManager(i_Game); MotherShip = new MotherShip(i_Game); CurrentTotalScore = 0; SoundManager = Game.Services.GetService(typeof(ISoundManager)) as ISoundManager; BlendState = BlendState.NonPremultiplied; }
// Use this for initialization void Start() { MSScript = GameObject.Find("MotherShip").GetComponent <MotherShip>(); // totResources = this.gameObject.GetComponentInParent<TotalResources>(); bShipOBJ = GameObject.FindGameObjectsWithTag("Battle Ship"); for (int i = 0; i < bShipOBJ.Length; i++) { BSUpgradeResource[i] = bShipOBJ[i].GetComponent <UpgradeResource>(); } }
// private GameObject BattleShip2; // Use this for initialization void Start() { MSScript = GameObject.Find("MotherShip").GetComponent <MotherShip>(); bShipOBJ = GameObject.FindGameObjectsWithTag("Battle Ship"); for (int i = 0; i < bShipOBJ.Length; i++) { BattleShips[i] = bShipOBJ[i].GetComponent <BattleShip>(); } }
private void FixedUpdate() { if (MotherShip != null && MotherShip.IsFunctional) { var hor = Input.GetAxis($"P{MotherShip.PlayerNumber}Horizontal"); var ver = Input.GetAxis($"P{MotherShip.PlayerNumber}Vertical"); Vector2 force = new Vector2(hor, ver); force = Vector2.ClampMagnitude(force, 1f); var dot = Mathf.Max(Vector2.Dot(Direction, force), 0); MotherShip.ApplyThrust(dot * ThrustForce, transform.position, transform.up); animation.TargetSize = dot; } }
void Start() { animator = GetComponent <Animator>(); OriginalPosition = transform.position; OriginalRotation = transform.rotation; spriteRenderer = GetComponent <SpriteRenderer>(); originalMainColor = spriteRenderer.sharedMaterial.GetColor("_MainColor"); originalSecondaryColor = spriteRenderer.sharedMaterial.GetColor("_SecondaryColor"); CreateGhost(); HideGhost(); rb = GetComponent <Rigidbody2D>(); coll = GetComponent <Collider2D>(); ship = GameObject.FindGameObjectWithTag("MotherShip").GetComponent <MotherShip>(); }
public void SpawnPos() { if (GameManager.pickedMob.layer == 8) { MotherShip ship = GameManager.pickedMob.GetComponent <MotherShip>(); ship.m_SpawnPos = true; } if (GameManager.pickedMob.layer == 9) { ChildShip ship = GameManager.pickedMob.GetComponent <ChildShip>(); ship.c_SpawnPos = true; } if (GameManager.pickedMob.layer == 10) { } }
public PlayScreen(Game i_Game) : base(i_Game) { if (Game.Services.GetService <ICollisionsManager>() != null) { Game.Services.RemoveService(typeof(ICollisionsManager)); } m_GameSettings = Game.Services.GetService <GameSettings>(); new CollisionsManager(i_Game); m_Background = new Sprite(@"Sprites\BG_Space01_1024x768", i_Game); MotherShip motherShip = new MotherShip(i_Game); motherShip.NotifyDead += addScore; Add(motherShip); m_Player1Score = new TextInformationDispaly(i_Game, "P1 Score: ", "0", Color.RoyalBlue); m_Player1Lives = new LineOfSprites(i_Game, @"Sprites\Ship01_32x32", 3, new Color(Color.White, 0.5f), new Vector2(0.5f)); Add(m_Player1Score); Add(m_Player1Lives); m_Player1 = new PlayerSpaceship(@"Sprites\Ship01_32x32", i_Game, Keys.H, Keys.K, Keys.U, true); m_Player1.LivesChanged += m_Player1Lives.ChangeNumOfSprites; m_Player1.NotifyDead += decreaseOnePlayer; m_Player1.ScoreChanged += m_Player1Score.UpdateInformation; Add(m_Player1); m_NumOfAlivePlayers = m_GameSettings.NumOfPlayers; if (m_NumOfAlivePlayers == 2) { m_Player2Score = new TextInformationDispaly(i_Game, "P2 Score: ", "0", Color.Green); m_Player2Lives = new LineOfSprites(i_Game, @"Sprites\Ship02_32x32", 3, new Color(Color.White, 0.5f), new Vector2(0.5f)); Add(m_Player2Score); Add(m_Player2Lives); m_Player2 = new PlayerSpaceship(@"Sprites\Ship02_32x32", i_Game, Keys.A, Keys.D, Keys.W, false); m_Player2.LivesChanged += m_Player2Lives.ChangeNumOfSprites; m_Player2.NotifyDead += decreaseOnePlayer; m_Player2.ScoreChanged += m_Player2Score.UpdateInformation; Add(m_Player2); } m_Barriers = new Barrier[k_NumOfBarriers]; for (int i = 0; i < k_NumOfBarriers; i++) { m_Barriers[i] = new Barrier(i_Game); Add(m_Barriers[i]); } m_Enemies = new EnemiesFormation(i_Game, addScore, endGame, levelUp); Add(m_Enemies); }
/// <summary> /// Starts a new game. /// </summary> private void StartNewGame() { // Set up the game screen Clear(Colors.Black); _mothership = new MotherShip(this, 1); _forceField = new ForceField(this, 12); _playerShip = new PlayerShip(this, 38); _score = 0; _lives = 3; _state = GameState.InGame; // A bit faster will do... SetFps(6); }
private void initLevelDetails() { Background background = new Background(m_Game, this); SpaceshipPlayers players = new SpaceshipPlayers(m_Game, this); this.Add(players); MotherShip motherShip = new MotherShip(m_Game, this); Enemies enemies = new Enemies(this, m_Game); this.Add(enemies); int numOfBarriers = 4; Barriers barriers = new Barriers(this, m_Game, numOfBarriers); this.Add(barriers); m_PlayersManager = Game.Services.GetService(typeof(IPlayersManager)) as IPlayersManager; m_PlayersManager.GameOverEvent += onGameOver; m_PlayersManager.LevelWonEvent += onLevelWon; }
public PlayScreen(Game i_Game) : base(i_Game) { GameManager gameManager; ScreenBackground background = new ScreenBackground(i_Game, Color.DarkCyan, @"GameAssets\BG_Space01_1024x768"); MotherShip motherShip = new MotherShip(i_Game, Color.Red); gameManager = this.Game.Services.GetService(typeof(IGameManager)) as GameManager; gameManager.LevelPassed += gameManager_LevelPassed; gameManager.GameOver += gameManager_GameOver; m_EnemyMatrix = new EnemyMatrix(i_Game); m_BarrierList = new BarrierList(i_Game, Color.LightGreen); m_PauseScreen = new PauseScreen(i_Game); this.Add(background); this.Add(m_EnemyMatrix); createPlayers(gameManager); this.Add(motherShip); this.Add(m_BarrierList); }
static void Main() { var motherShipOne = new MotherShip("X-wing"); var motherShipTwo = new MotherShip("Sky Lynx"); var fighterIronMan = new Fighter("Tony Stark"); var fighterBigShip = new Fighter("Tanos"); var fighterRainbowBridge = new Fighter("Tor"); motherShipOne.AddFighter(fighterIronMan, fighterBigShip, fighterRainbowBridge); motherShipOne.PrintAll(); motherShipTwo.AddFighter(fighterBigShip); motherShipTwo.PrintAll(); // Destroy! fighterBigShip.HP = -115; motherShipOne.PrintAll(); motherShipTwo.PrintAll(); }
public PlayScreen(Game i_Game, GameState i_GameState = null) : base(i_Game) { Background background = new Background(this.Game, this); m_GameSettings = (this.Game.Services.GetService(typeof(IGameSettings)) as SpaceInvadersSettings); if (m_GameSettings == null) { m_GameSettings = new SpaceInvadersSettings(this.Game); } setGameState(i_GameState, m_GameSettings); createPlayersAndScoreManagers(); m_Enemies = new EnemiesGroup(this.Game, this); m_Barriers = new Barriers(this.Game, this); m_MotherSpaceship = new MotherShip(this.Game, this); m_MotherShipRandomNotifier = new RandomActionComponent(); m_MotherShipRandomNotifier.RandomTimeAchieved += motherShipRandomNotifier_GoMotherSpaceship; }
/* * If there is no target and there is another potential target within range, then attack that target */ private void OnTriggerStay(Collider other) { Unit other_unit = other.GetComponent <Unit>(); MotherShip other_mother = other.GetComponent <MotherShip>(); /* * if (unit.hasTarget && other_unit != null && other_mother != null) * { * if(other_unit == unit.target || other_mother == unit.MotherTarget) * { * unit.AttackTarget(); * } * } */ if (unit.hasTarget) { if (other_unit != null && other_unit == unit.target) { unit.AttackTarget(); } else if (other_mother != null && other_mother == unit.MotherTarget) { unit.AttackTarget(); } } else if (other_unit != null && other_unit.Team == TargetTeam) { unit.hasTarget = true; unit.target = other_unit; other_unit.unitDead.AddListener(unit.TargetDead); unit.AttackTarget(); } else if (other_mother != null && other_mother.Team == TargetTeam) { unit.hasTarget = true; unit.MotherTarget = other_mother; unit.AttackTarget(); } }