public void handleProjectileHit(ProjectileController projectile) { if (projectile.Owner == GameplayManager.Samus && m_invincibilityCounter <= 0) { GameplayManager.Samus.model.setStat("damageDone", GameplayManager.Samus.model.getStat("damageDone") + projectile.Damage); handleSamusProjectileHit(projectile); } }
protected override void handleSamusProjectileHit(ProjectileController projectile) { projectile.handleSceneryHit(); if (projectile.Freezes) { this.m_frozenCounter = s_frozenDuration; this.m_collider.m_type = ColliderType.FrozenEnemy; this.m_invincibilityCounter = s_invincibilityDuration; } }
protected virtual void handleSamusProjectileHit(ProjectileController projectile) { projectile.handleSceneryHit(); if (projectile.Freezes && this.Health <= this.MaxHealth / 2 && !this.IsFrozen) { this.m_frozenCounter = s_frozenDuration; this.m_collider.m_type = ColliderType.FrozenEnemy; this.m_invincibilityCounter = s_invincibilityDuration; } else { this.takeDamage(projectile.Damage); if (this.Health <= 0) { Vector2 explosion = new Vector2( m_position.X, m_position.Y - (float)m_collider.Bounds.Height / 2); GameplayManager.ActiveZone.add(new BulletExplosion(explosion, 8.0f)); } } }
// Use this for initialization void Start () { this.currentWeapon = 0; this.SwitchWeapons(); projectiles = GetComponent<ProjectileController>(); }
public void handleProjectileHit(ProjectileController projectile) { m_state = State.ItemRevealed; m_collider.m_type = ColliderType.Trigger; }
private void fireSpike(int spikeIdx) { Vector2 shootPoint = AnimationController.getShootPoint(this.DrawPosition); shootPoint += getSpikeOffset(spikeIdx); ProjectileController spike = new ProjectileController( this, shootPoint, new Vector2(m_facingRight ? c_spikeSpeed : -c_spikeSpeed, 0), ProjectileType.Spike, 30, c_SpikeTexturePath); GameplayManager.ActiveZone.add(spike); }
protected override void handleSamusProjectileHit(ProjectileController projectile) { this.takeDamage(projectile.Damage); if (this.Health % 3 == 1) { changeState(State.Open); } }
public override void LoadContent() { ContentManager content = ScreenManager.Game.Content; map = content.Load<Map>("map"); MapGeneration.Generate(map); camera = new Camera(ScreenManager.Game.RenderWidth, ScreenManager.Game.RenderHeight, map); //camera.Zoom = 0.5f; text = content.Load<Texture2D>("titles"); hud = new HUD(content.Load<Texture2D>("hud")); waterLevel = ScreenManager.Game.RenderHeight; waterParallax = new Parallax(content.Load<Texture2D>("abovewater-parallax"), 12, 0.5f, waterLevel, (map.TileWidth * map.Width), new Viewport(0, 0, ScreenManager.Game.RenderWidth, ScreenManager.Game.RenderHeight), false, true); underwaterBGParallax = new Parallax(content.Load<Texture2D>("underwater-bg"), 4, 1f, waterLevel + 20, (map.TileWidth * map.Width), new Viewport(0, 0, ScreenManager.Game.RenderWidth, ScreenManager.Game.RenderHeight), true, false); skyBGParallax = new Parallax(content.Load<Texture2D>("sky-bg"), 72, 1f, 70, (map.TileWidth * map.Width), new Viewport(0, 0, ScreenManager.Game.RenderWidth, ScreenManager.Game.RenderHeight), false, false); rocksParallax = new Parallax(content.Load<Texture2D>("seabed-rocks"), 16, 0.35f, (map.TileHeight*map.Height) -15, (map.TileWidth * map.Width), new Viewport(0, 0, ScreenManager.Game.RenderWidth, ScreenManager.Game.RenderHeight), false, false); cloudsParallax = new Parallax(content.Load<Texture2D>("clouds"), 16, 0.35f, 25, (map.TileWidth * map.Width), new Viewport(0, 0, ScreenManager.Game.RenderWidth, ScreenManager.Game.RenderHeight), false, false, true); playerShip = new Ship(content.Load<Texture2D>("playership"), new Rectangle(0,0,10,10), null, Vector2.Zero); playerShip.Position = new Vector2(64, 190); particleController.LoadContent(content); projectileController = new ProjectileController(1000, sheet => new Projectile(sheet, new Rectangle(0, 0, 4, 4), null, new Vector2(0, 0)) , content.Load<Texture2D>("projectiles")); enemyController = new EnemyController(content.Load<Texture2D>("enemies"), content.Load<Texture2D>("boss")); powerupController = new PowerupController(1000,sheet => new Powerup(sheet, new Rectangle(0, 0, 6, 6), null, Vector2.Zero),content.Load<Texture2D>("powerup")); powerupController.BoxCollidesWith.Add(playerShip); projectileController.BoxCollidesWith.Add(playerShip); projectileController.BoxCollidesWith.Add(enemyController); projectileController.BoxCollidesWith.Add(projectileController); enemyController.BoxCollidesWith.Add(playerShip); enemyController.BoxCollidesWith.Add(projectileController); GameController.Reset(); //enemyController.SpawnInitial(GameController.Wave, map); base.LoadContent(); }
void Update() { if(Input.GetKey(KeyCode.Keypad9)){ freeView = true; } if(Input.GetKey(KeyCode.Keypad7)){ freeView = false; } time += Time.deltaTime; if(!GameMaster.hasWon && !GameMaster.levelComplete && !GameMaster.hasLost && Time.timeScale == 1.0f){ positionSelected = new Vector3(-1,-1,-1); foreach (Touch touch in Input.touches) { if (touch.phase == TouchPhase.Began) { positionSelected = touch.position; } } if (Input.GetButtonDown("Fire1") && positionSelected==new Vector3(-1,-1,-1)) { positionSelected = Input.mousePosition; } if(freeView){ }else{ if(positionSelected != new Vector3(-1,-1,-1) && weaponReady){ Ray ray = Camera.main.ScreenPointToRay (positionSelected); RaycastHit hit; if (Physics.Raycast(Camera.main.transform.position, ray.direction, out hit) && raycastMagazinedBalls(hit.transform)){ swapBall(); }else if(positionSelected[0] <130 && positionSelected[1] <260){ //Stop from shooting when clicking bomb powerup icon. Values are by trial and error }else{ //Shoots //Sets bomb model and bomb collider size if(balls[0].name=="Bomb"){ float radius = (float)GameMaster.upgrades["BombSize"]/20; (balls[0].gameObject.collider as SphereCollider).radius = radius; Transform bombModel = balls[0].FindChild("Bomb(Clone)"); float size = (float)GameMaster.upgrades["BombSize"]/10; bombModel.transform.localScale = new Vector3(size,size,size); } //Count a freeView powerup used if(freeViewUsedThisRound){ freeViewUsedThisRound = false; GameMaster.upgrades["FreeView"]--; } controllerScript = balls[0].GetComponent<ProjectileController>(); balls[0].transform.localPosition = new Vector3(0,0,0); balls[0].transform.rotation = transform.rotation; balls[0].transform.parent = null; controllerScript.StartMove(ray.direction); balls[0].tag = "BigBall"; weaponReady = false; time = 0; EventManager.ObjectFired(balls[0].name); //Set balls[0] variable to null so a new ball can be loaded balls[0] = null; } } } } /*if(Input.GetKey(KeyCode.Keypad2)){ balls[0].renderer.material.color = Color.blue; magazinedBall.renderer.material.color = Color.blue; }*/ }
private void UpgradeWeapons(int iterationCount, ProjectileController projectilePrefab, WeaponType weaponType) { //upgrade weapons and projectiles for each upgrade point for (int i = 0; i < iterationCount; i++) { //increase stats of projectile prefab UpgradeProjectile(projectilePrefab, weaponType); foreach (WeaponController weapon in player.GetWeapons()) { if (weapon.GetWeaponType() == weaponType) { //increase weapon stats if (GetWeaponRank(weaponType) < 5) { weapon.Interval /= 1.25f; } else if (GetWeaponRank(weaponType) < 10) { weapon.Interval /= 1.15f; } else { weapon.Interval /= 1.05f; } ObjectPooler pooler = weapon.GetComponent<ObjectPooler>(); if (pooler != null) { //increase stats of pooled projectiles foreach (GameObject obj in pooler.GetPooledObjects()) { ProjectileController projectile = obj.GetComponent<ProjectileController>(); UpgradeProjectile(projectile, weaponType); } } } } } }
private void UpgradeProjectile(ProjectileController projectile, WeaponType weaponType) { if (GetWeaponRank(weaponType) < 5) { projectile.Damage *= 1.25f; } else if (GetWeaponRank(weaponType) < 10) { projectile.Damage *= 1.15f; } else { projectile.Damage *= 1.05f; } ObjectChaser chaser = projectile.GetComponent<ObjectChaser>(); if (chaser != null) { //increase weapon stats if (GetWeaponRank(weaponType) < 5) { chaser.Delay /= 1.25f; chaser.Precision *= 1.25f; } else if (GetWeaponRank(weaponType) < 10) { chaser.Delay /= 1.15f; chaser.Precision *= 1.15f; } else { chaser.Delay /= 1.05f; chaser.Precision *= 1.05f; } } }