Ejemplo n.º 1
0
            public void CreateProjectile(TTurretWeapon weapon)
            {
                float   angle = MainBlock.GetAngle() + MainBlockAngle + GlobalRandom.Next(-weapon.Scatter, weapon.Scatter + 1) / 180.0f * (float)Math.PI;
                Vector2 pos   = MainMotor.GetWorldPosition();
                Vector2 dir   = new Vector2((float)Math.Cos(angle) * 10, (float)Math.Sin(angle) * 10);

                if (weapon.BulletType >= 0)
                {
                    GlobalGame.SpawnProjectile((ProjectileItem)weapon.BulletType, pos + dir, dir);
                }
                else if (weapon.BulletType == -1)
                {
                    GlobalGame.SpawnFireNode(pos + dir, dir * 2, FireNodeType.Flamethrower);
                }
                else if (weapon.BulletType == -2)
                {
                    ElectricExplosion(MainMotor.GetWorldPosition(), 20, 50);
                }
                else if (weapon.BulletType == -3)
                {
                    ForceImpulse(MainMotor.GetWorldPosition(), 10, 50);
                }
                GlobalGame.PlaySound(weapon.Sound, MainMotor.GetWorldPosition(), 1.0f);
            }