//public: public Bullet(Double x_, Double y_, Int32 width_, Int32 height_, Int32 damage_, BulletKind kind_) { PosX = x_; PosY = y_; Width = width_; Height = height_; switch (kind_) { case BulletKind.Laser: { _type = BulletType.Laser; break; } case BulletKind.Exploded: { _type = BulletType.Exploded; break; } case BulletKind.Rocket: { _type = BulletType.Rocket; break; } } Damage = damage_+_type._bonusdamage; _active = true; _vx = 1; _vy = 0; _speed = _type.speed; }
IEnumerator FireCo() { yield return(new WaitForSeconds(0.1f)); c.moveCon.Transition(PlayerState.attkck, true); if (c.abilityCon.HasAbility(AbilityKind.Double)) { curKind = BulletKind.DoubleChain; } Shot shot = new Shot(OnClearShot); if (c.abilityCon.HasAbility(AbilityKind.Triple)) { Shoot(0f, shot); Shoot(45f, shot); Shoot(-45f, shot); } else { Shoot(0f, shot); } shots.Add(shot); }
void Fire() { if (shots.Count >= c.stat.maxBulletCount) { return; } //if ( fireCo != null ) StopCoroutine( fireCo ); //fireCo = StartCoroutine( FireCo() ); c.moveCon.Transition(PlayerState.attkck, true); if (c.abilityCon.HasAbility(AbilityKind.Double)) { curKind = BulletKind.DoubleChain; } Shot shot = new Shot(OnClearShot); if (c.abilityCon.HasAbility(AbilityKind.Triple)) { Shoot(0f, shot); Shoot(45f, shot); Shoot(-45f, shot); } else { Shoot(0f, shot); } shots.Add(shot); AudioController.Play("PlayerShot"); }
//public: public Ship(Int32 width_, Int32 height_) { Health = 100; _shield = 100; _type = ShipType.SmallShip; Width = width_; Height = height_; Damage = _type.basedamage; _bulletkind = BulletKind.Laser; _modules = new Dictionary<ModuleKind, Module>(); foreach (ModuleKind val in Enum.GetValues(typeof(ModuleKind))) { _modules.Add(val, new Module(val)); } }
/// <summary> /// Initializes a new instance of the Bullet class with given top-left point coordinate and bullet kind. /// </summary> /// <param name="startX">X-coordinate of the top-left point of the bullet image to show.</param> /// <param name="startY">Y-coordinate of the top-left point of the bullet image to show.<</param> /// <param name="bulletKind">Specifies which kind of bullet it is.</param> public Bullet(double startX, double startY, BulletKind bulletKind) { // Initialize the image to show. this.BulletImage = new Image(); // Calculate the coordiate of the warhead. this.WarheadX = startX + Settings.BulletWarheadLeftOffset; this.WarheadY = startY + Settings.BulletWarheadTopOffset; // Save the bullet kind. if (bulletKind == BulletKind.Bullet1) { this.BulletImage.Source = Bullet.Bullet1Image; } else { this.BulletImage.Source = Bullet.Bullet2Image; } }
public Boolean UpgradeBullet() { switch (_bulletkind) { case BulletKind.Laser: _bulletkind = BulletKind.Exploded; break; case BulletKind.Exploded: _bulletkind = BulletKind.Rocket; break; default: return false; } return true; }