示例#1
0
 public Plane4(int Resist, int BombTimeMax)
     : base(Resist, PlaneSprite, MaskPlane)
 {
     Direction(3);
     ActiveLaser = new LaserWeapon(Position);
     EnemyAttack.AddEnemyAttack(ActiveLaser);
 }
    IEnumerator GenerateWaveCoroutine()
    {
        _bGeneratingWave = true;
        _manager.WriteCom("Alerta");

        for (int i = 0; i < _enemiesQuantityPerWave; ++i)
        {
            GameObject spawnPoint = _spawnPoints[i];
            GameObject newEnemy   = _enemyPool.GetObjectFromPool("Enemy");

            newEnemy.transform.position = spawnPoint.transform.position + Random.insideUnitSphere * _spawnRadio;
            newEnemy.transform.forward  = spawnPoint.transform.forward;
            newEnemy.transform.SetParent(spawnPoint.transform);

            Enemy enemy = newEnemy.GetComponent <Enemy>();
            enemy.LifePoints += (_currentWave + 1) + _difficulty * (_currentWave + 1);
            enemy.target      = _player.gameObject;

            LaserWeapon laser = newEnemy.GetComponent <LaserWeapon>();
            laser.Damage += _currentWave + _difficulty * _currentWave;

            MissileWeapon missile = newEnemy.GetComponent <MissileWeapon>();
            missile.Damage += (_currentWave + 1) * _difficulty * _currentWave;

            _currentEnemies++;
            yield return(new WaitForSeconds(.1f));
        }
        _manager.WriteCom(string.Format("Oleada {0}" +
                                        "\nEnemigos en combate: {1}", _currentWave + 1, _currentEnemies));
        _currentWave++;
        _enemiesQuantityPerWave += _enemiesQuantityPerWave / (_currentWave + 1);
        //_enemiesQuantityPerWave += (int)(_spawnPoints.Length/12 + _difficulty*2);

        _bGeneratingWave = false;
    }
示例#3
0
 protected virtual void Awake()
 {
     LifePoints     = _maxLife;
     _laserWeapon   = GetComponent <LaserWeapon>();
     _missileWeapon = GetComponent <MissileWeapon>();
     _rigidbody     = GetComponent <Rigidbody>();
 }
示例#4
0
    // Use this for initialization
    void Awake()
    {
        _player              = FindObjectOfType <Player>();
        _playerAutoAim       = _player.GetComponent <AutoAim>();
        _playerLaser         = _player.GetComponent <LaserWeapon>();
        _playerMissile       = _player.GetComponent <MissileWeapon>();
        _playerShieldManager = _player.GetComponent <ShieldManager>();

        InvokeRepeating("WaitingCom", 0, 1);
    }
示例#5
0
        public Weapon(Game game, Vector2 position)
        {
            WeaponState = WeaponState.Normal;
            Position    = position;

            RocketWeapon   = new RocketWeapon(game, Position);
            LaserWeapon    = new LaserWeapon(game, Position);
            NormalWeapon   = new NormalWeapon(game, Position);
            _currentWeapon = NormalWeapon;
            _font          = AssetsManager.Tahoma;
        }
示例#6
0
文件: Hero.cs 项目: flpqsv/Test
            public Weapon ChooseWeapon()
            {
                Console.WriteLine("Please choose weapon: Laser (1), Missile (2), Machine (3).");
                var    useruserInput = Console.ReadLine();
                Weapon weapon;

                switch (useruserInput)
                {
                case "1": weapon = new LaserWeapon(); break;

                case "2": weapon = new MissileWeapon(); break;

                case "3": weapon = new MachineWeapon(); break;

                default: throw new ArgumentException();
                }

                return(weapon);
            }
示例#7
0
    void Start()
    {
        newGameBTN.onClick.AddListener(newGameFCN);
        resumeGameBTN.onClick.AddListener(resumeGameFCN);

        if (PlayerPrefs.GetInt("GamePlay") > 0)
        {
            resumeGameBTN.interactable = true;
        }

        PlayerPrefs.DeleteKey("Health");
        PlayerPrefs.DeleteKey("StartTime");
        PlayerPrefs.DeleteKey("Score");
        PlayerPrefs.DeleteKey("Distance");
        PlayerPrefs.DeleteKey("Health");
        PlayerPrefs.DeleteKey("Die");


        modSelectPanel.transform.GetChild(0).transform.DOScale(0, 0.1f);
        modSelectPanel.transform.GetChild(1).transform.DOScale(0, 0.1f);
        modSelectPanel.transform.GetChild(2).transform.DOScale(0, 0.1f);

        modSelectPanel.transform.GetChild(0).GetComponent <Button>().onClick.AddListener(() => { gameModeSelect(0); });
        modSelectPanel.transform.GetChild(1).GetComponent <Button>().onClick.AddListener(() => { gameModeSelect(1); });
        modSelectPanel.transform.GetChild(2).GetComponent <Button>().onClick.AddListener(() => { gameModeSelect(2); });
        playBTN.interactable = false;

        //init weapons Data for info panel
        Debug.Log("cascascascascasc");
        LaserWeapon wp1 = new LaserWeapon("Weapon1", 10, 10, 5000, 3);
        LaserWeapon wp2 = new LaserWeapon("Weapon2", 15, 15, 10000, 4);
        LaserWeapon wp3 = new LaserWeapon("Weapon3", 20, 20, 15000, 5);


        laserWeapons.Add("0", wp1);
        laserWeapons.Add("1", wp2);
        laserWeapons.Add("2", wp3);
        addListeners();
    }
示例#8
0
    static void Main(string[] args)
    {
        // Manipulate the ballistic weapon in its own specific way:
        var ballisticWeapon = new BallisticWeapon();

        ballisticWeapon.Projectile       = new BallisticMissile();
        ballisticWeapon.Projectile.Speed = 2000;
        // Manipulate the laser weapon in its own specific way:
        var laserWeapon = new LaserWeapon();

        laserWeapon.Projectile            = new LaserBeam();
        laserWeapon.Projectile.WaveLength = 400;
        // But you can still use both of them as an IWeapon<IProjectile>:
        var weapons = new List <IWeapon <IProjectile> >();

        weapons.Add(ballisticWeapon);
        weapons.Add(laserWeapon);
        foreach (var weapon in weapons)
        {
            Console.WriteLine(weapon.Projectile.Name);
        }
    }
示例#9
0
    private LaserWeapon CreateLaserWeaponFromText(GameObject owner, List <string> paramsText, List <string> instantEffectsText, List <string> longEffectsText)
    {
        LaserWeapon weapon = (LaserWeapon)ScriptableObject.CreateInstance("LaserWeapon");

        //Parameters
        weapon.CooldownTime             = float.Parse(paramsText[1]);
        weapon.OverheatTime             = float.Parse(paramsText[2]);
        weapon.Intensity                = float.Parse(paramsText[3]);
        weapon.MaxLaserBeamLength       = float.Parse(paramsText[4]);
        weapon.ShootingPoint            = owner.transform.FindChild("Graphics").FindChild("Tower").FindChild("ShootingPoint");
        weapon.LaserBeam                = Instantiate(LaserBeamPrefab).GetComponent <LineRenderer>();
        weapon.LaserBeamParticlesPrefab = LaserBeamParticlesPrefab;
        weapon.DummyMonoBehaviour       = this;

        //Instant effects
        List <InstantEffect> instantEffects = CreateInstantEffectsFromText(instantEffectsText);

        foreach (InstantEffect effect in instantEffects)
        {
            weapon.AddInstantEffect(effect);
        }

        return(weapon);
    }
示例#10
0
    public void Shoot(Vector2 startPos, Quaternion startRot, Vector2 startingDir, Vector2 followDir,
                      List <LaserBlast> p, Transform wep, Entity shooter, double ID, LaserWeapon wepSystem)
    {
        firingPos          = startPos;
        transform.position = startPos;
        transform.rotation = startRot;
        vel = startingDir * startSpeed;
        followDir.Normalize();
        direction = followDir * inwardMomentumMultiplier;
        pool      = p;
        weapon    = wep;
        forward   = weapon.up;
        converged = false;
        particleTrail.gameObject.SetActive(true);
        particleTrail.Play();
        particleTrail.transform.parent        = transform;
        particleTrail.transform.localPosition = Vector3.zero;
        parent       = shooter;
        sharedID     = ID;
        weaponSystem = wepSystem;

        gameObject.SetActive(true);
        GetAttackManager.AddAttackComponent <OwnerComponent>(shooter);
    }
示例#11
0
    public void ReturnPlayerData(GameObject source)
    {
        Projectile projectile = source.GetComponent <Projectile> ();
        PlayerData playerData = null;

        if (projectile != null)
        {
            playerData = projectile.PlayerData;
        }
        else
        {
            LaserWeapon laserWeapon = source.GetComponent <LaserWeapon> ();
            if (laserWeapon != null)
            {
                playerData = laserWeapon.playerData;
            }
        }

        if (playerData != null)
        {
            playerData.IncrementEnemiesKilled();
            playerData.IncrementScorePickedUp(scoreValue);
        }
    }
示例#12
0
        public override void Update(float TimeEllapsed)
        {
            if (AttackType == AttackTypes.None)
            {
                if (Position.X <= 104)
                {
                    Speed.X = SpeedX * TimeEllapsed;
                }
                else if (Position.X >= 920)
                {
                    Speed.X = -SpeedX * TimeEllapsed;
                }

                --AttackTypeTimer;
                if (AttackTypeTimer <= 0)
                {
                    UpdateAttackTypeTimer();
                }
            }
            else if (AttackType == AttackTypes.Missiles)
            {
                --MissilesTimer;
                if (MissilesTimer <= 0)
                {
                    UpdateMissilesTimer();
                }

                ++MissilesPhaseTimer;

                if (MissilesPhaseTimer >= 150)
                {
                    MissilesPhaseTimer = 0;
                    AttackType         = AttackTypes.None;
                }
                if (Position.X <= 507)
                {
                    Speed.X = SpeedX * TimeEllapsed;
                }
                else if (Position.X >= 518)
                {
                    Speed.X = -SpeedX * TimeEllapsed;
                }
                else
                {
                    Position.X = 512;
                    Speed.X    = 0;
                }
            }
            else if (AttackType == AttackTypes.Laser)
            {
                LaserPhaseTimer += 1;
                if (LaserPhaseTimer < 90)
                {
                    new LaserParticle(new Vector2(Position.X - 20 + SuperTank2.Randomizer.Next(40), Position.Y + 118), SuperTank2.Randomizer.Next(360) * SuperTank2.DegToRad, SuperTank2.Randomizer.NextDouble() * 5).AddParticule();
                }
                else if (LaserPhaseTimer == 90)
                {
                    ActiveLaser = new LaserWeapon(new Vector2(Position.X, Position.Y + 111));
                    EnemyAttack.AddEnemyAttack(ActiveLaser);
                }
                else if (ActiveLaser.Lifetime <= 0)
                {
                    LaserPhaseTimer = 0;
                    AttackType      = AttackTypes.None;
                }
                Vehicule Near        = null;
                float    DistanceMin = float.MaxValue;
                for (int V = 0; V < Vehicule.ArrayVehicule.Length; V++)
                {
                    float Distance = Vector2.Distance(Position, Vehicule.ArrayVehicule[V].Position);
                    if (Distance < DistanceMin)
                    {
                        DistanceMin = Distance;
                        Near        = Vehicule.ArrayVehicule[V];
                    }
                }
                if (Position.X <= Near.Position.X - Speed.X)
                {
                    if (LaserPhaseTimer < 90)
                    {
                        Speed.X = SpeedX * 0.6f * TimeEllapsed;
                    }
                    else
                    {
                        Speed.X = SpeedX * 0.2f * TimeEllapsed;
                    }
                }
                else if (Position.X >= Near.Position.X + Speed.X)
                {
                    if (LaserPhaseTimer < 90)
                    {
                        Speed.X = -SpeedX * 0.6f * TimeEllapsed;
                    }
                    else
                    {
                        Speed.X = -SpeedX * 0.2f * TimeEllapsed;
                    }
                }
                else
                {
                    Position.X = Near.Position.X;
                    Speed.X    = 0;
                }
            }

            Position += Speed;

            UpdateTransformationMatrix();

            if (ActiveLaser != null)
            {
                ActiveLaser.Position.X = Position.X;
            }

            if (Resist <= 0)
            {
                if (Destroy > 0)
                {
                    Destroy--;
                    new FlameParticle(new Vector2(Position.X + SuperTank2.Randomizer.Next(300) - 150, Position.Y + SuperTank2.Randomizer.Next(100) - 50), Vector2.Zero).AddParticule();
                }
                else
                {
                    IsAlive = false;
                }
            }
        }
示例#13
0
	protected LaserWeapon(LaserWeapon other) : base(other)
	{
		this.CoolDownTime = other.CoolDownTime;
	}
示例#14
0
    // Create a deep copy of this weapon instance
    public override Weapon DeepCopy(WeaponData weaponData, Player player)
    {
        LaserWeapon copy = new LaserWeapon(weaponData, player);

        return(copy);
    }