Exemplo n.º 1
0
    public void UnRegisterPickup(TankDefs.BulletType bulletType, BaseBulletPickup pickupBehaviour)
    {
        switch (bulletType)
        {
        case TankDefs.BulletType.LonglivingShot:

            LonglivingShotPickup lsp = pickupBehaviour.GetComponent <LonglivingShotPickup>();
            if (lsp != null && longlivingShotPickupsSpawned.Contains(lsp))
            {
                longlivingShotPickupsSpawned.Remove(lsp);
            }

            break;

        case TankDefs.BulletType.Minigun:

            MinigunPickup mp = pickupBehaviour.GetComponent <MinigunPickup>();
            if (mp != null && minigunPickupsSpawned.Contains(mp))
            {
                minigunPickupsSpawned.Remove(mp);
            }

            break;

        case TankDefs.BulletType.Shotgun:

            ShotgunPickup sp = pickupBehaviour.GetComponent <ShotgunPickup>();
            if (sp != null && shotgunPickupsSpawned.Contains(sp))
            {
                shotgunPickupsSpawned.Remove(sp);
            }

            break;


        case TankDefs.BulletType.Shield:

            ShieldPickup slp = pickupBehaviour.GetComponent <ShieldPickup>();
            if (slp != null && shieldPickupsSpawned.Contains(slp))
            {
                shieldPickupsSpawned.Remove(slp);
            }

            break;
        }
    }
Exemplo n.º 2
0
 public Player(int x, int y, char Symbol, Team TeamNumber, bool autoAim, Game g) : base(x, y, TeamNumber, g)
 {
     CurrentState            = new IdleState(this);
     KeyBindings             = new Dictionary <Keys, PlayerState>();
     IsFiring                = true; //always in fire-Mode
     TemporarilyDead         = false;
     RespawnTime             = 300;
     CurrentRespawnCycleTime = RespawnTime;
     //Shielded = true;
     //give him a shield as a starting bonus
     CurrentPickup = new ShieldPickup(0, 0, TheGame);
     //player is a bit faster than the others
     speed = 4;
     //and has the best weapon from the start
     CurrentWeapon = new Wings(TheGame, this);//Flamethrower(TheGame, this);
     this.autoAim  = autoAim;
     this.Symbol   = Symbol;
 }
Exemplo n.º 3
0
 public override void move()
 {
     if (!TemporarilyDead)
     {
         if (CurrentPickup != null)
         {
             //change "State" of the Pickup, to implement single use, cooldown and so on
             CurrentPickup = CurrentPickup.interactWithFighter(this);
         }
         CurrentState.move();
     }
     else
     {
         if (CurrentRespawnCycleTime-- < 0)
         {
             CurrentRespawnCycleTime = RespawnTime;
             TemporarilyDead         = false;
             IsFiring      = true;
             CurrentPickup = new ShieldPickup(0, 0, TheGame);
             HP            = 100;
         }
         CurrentState.move();
     }
 }