Example #1
0
 public GetDamage(ITankLogic pLogic)
     : base(pLogic)
 {
     _basePolygon = new Polygon(0,0, 50,0, 50,50, 0,50);
     Tank.AddCollider(new PolygonCollider(_basePolygon, CollidableTags.Tank));
     Tank.Collider.CenterOrigin();
 }
Example #2
0
        public ControlNetwork(ITankLogic pLogic)
            : base(pLogic)
        {
            if(Program.GameMode.Mode != GameModes.Network)
                throw new NotSupportedException("The gamemode must be network multiplayer for this to work!");

            if(Program.GameMode is NetworkMultiplayer)
                ((NetworkMultiplayer) Program.GameMode).OnClientData += CommandHandler;
        }
Example #3
0
        public ControlNetworkHook(ITankLogic pLogic)
            : base(pLogic)
        {
            if(Program.GameMode.Mode != GameModes.Network)
                throw new NotSupportedException("The gamemode must be network multiplayer for this to work!");

            //at this point we are f****d if the gamemode isnt a client
            if (Program.GameMode is NetworkMultiplayer)
                _client = ((NetworkMultiplayer) Program.GameMode).Client;
        }
Example #4
0
        public ControlNetwork(ITankLogic pLogic) : base(pLogic)
        {
            if (Program.GameMode.Mode != GameModes.Network)
            {
                throw new NotSupportedException("The gamemode must be network multiplayer for this to work!");
            }

            if (Program.GameMode is NetworkMultiplayer)
            {
                ((NetworkMultiplayer)Program.GameMode).OnClientData += CommandHandler;
            }
        }
Example #5
0
        public ControlNetworkHook(ITankLogic pLogic) : base(pLogic)
        {
            if (Program.GameMode.Mode != GameModes.Network)
            {
                throw new NotSupportedException("The gamemode must be network multiplayer for this to work!");
            }

            //at this point we are f****d if the gamemode isnt a client
            if (Program.GameMode is NetworkMultiplayer)
            {
                _client = ((NetworkMultiplayer)Program.GameMode).Client;
            }
        }
Example #6
0
        public void AddDecorator(Decorators deco)
        {
            switch (deco)
            {
            case Decorators.ControlArrow:
                Logic = new ControlArrow(Logic);
                break;

            case Decorators.ControlJoy:
                Logic = new ControlJoy(Logic);
                break;

            case Decorators.ControlSimpleKi:
                Logic = new ControlSimpleKI(Logic);
                break;

            case Decorators.ControlWasd:
                Logic = new ControlWasd(Logic);
                break;

            case Decorators.GetDamage:
                Logic = new GetDamage(Logic);
                break;

            case Decorators.SpeedUp:
                Logic = new SpeedUp(Logic);
                break;

            case Decorators.WallCollider:
                Logic = new WallCollider(Logic);
                break;

            case Decorators.ControlNetwork:
                Logic = new ControlNetwork(Logic);
                break;

            case Decorators.UsePowerUps:
                Logic = new UsePowerUps(Logic);
                break;

            case Decorators.ControlNetworkHook:
                NetworkHook = new ControlNetworkHook(Logic);
                Logic       = NetworkHook;
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(deco), deco, null);
            }
        }
Example #7
0
        public Tank(float xPos, float yPos) : base(xPos, yPos)
        {
            Console.WriteLine("simpleTank");
            _image = new Image("Resources/tank.png");
            _image.CenterOrigin();
            AddGraphic(_image);
            Weapon = new Weapon(this);
            Weapon.addDecorator(ProjectileDecorators.TestBullet);
            Weapon.addDecorator(ProjectileDecorators.BulletWallCollider);

            //define this entity as part of the game pause group
            Group = (int)PauseGroups.NotMenu;

            //logic can now be instantiated here already
            Logic = new ProtoLogic(this);
        }
Example #8
0
 public ControlArrow(ITankLogic pLogic)
     : base(pLogic)
 {
 }
Example #9
0
 public ControlSimpleKI(ITankLogic pLogic)
     : base(pLogic)
 {
 }
Example #10
0
 public ControlArrow(ITankLogic pLogic) : base(pLogic)
 {
 }
Example #11
0
 public ControlWasd(ITankLogic pLogic) : base(pLogic)
 {
 }
Example #12
0
 public WallCollider(ITankLogic pLogic)
     : base(pLogic)
 {
 }
Example #13
0
 public ControlSimpleKI(ITankLogic pLogic) : base(pLogic)
 {
 }
Example #14
0
 public ControlJoy(ITankLogic pLogic) : base(pLogic)
 {
 }
Example #15
0
 public LogicDecorator(ITankLogic pLogic)
 {
     Logic           = pLogic;
     _uppermostLogic = (ProtoLogic)Logic.getUpperMost();
     Tank            = _uppermostLogic.Tank;
 }
Example #16
0
 public ControlJoy(ITankLogic pLogic)
     : base(pLogic)
 {
 }
Example #17
0
 public GetDamage(ITankLogic pLogic) : base(pLogic)
 {
     _basePolygon = new Polygon(0, 0, 50, 0, 50, 50, 0, 50);
     Tank.AddCollider(new PolygonCollider(_basePolygon, CollidableTags.Tank));
     Tank.Collider.CenterOrigin();
 }
Example #18
0
 public UsePowerUps(ITankLogic pLogic)
     : base(pLogic)
 {
 }
Example #19
0
 public WallCollider(ITankLogic pLogic) : base(pLogic)
 {
 }
Example #20
0
 public void AddDecorator(Decorators deco)
 {
     switch (deco)
     {
         case Decorators.ControlArrow:
             Logic = new ControlArrow(Logic);
             break;
         case Decorators.ControlJoy:
             Logic = new ControlJoy(Logic);
             break;
         case Decorators.ControlSimpleKi:
             Logic = new ControlSimpleKI(Logic);
             break;
         case Decorators.ControlWasd:
             Logic = new ControlWasd(Logic);
             break;
         case Decorators.GetDamage:
             Logic = new GetDamage(Logic);
             break;
         case Decorators.SpeedUp:
             Logic = new SpeedUp(Logic);
             break;
         case Decorators.WallCollider:
             Logic = new WallCollider(Logic);
             break;
         case Decorators.ControlNetwork:
             Logic = new ControlNetwork(Logic);
             break;
         case Decorators.UsePowerUps:
             Logic = new UsePowerUps(Logic);
             break;
         case Decorators.ControlNetworkHook:
             NetworkHook = new ControlNetworkHook(Logic);
             Logic = NetworkHook;
             break;
         default:
             throw new ArgumentOutOfRangeException(nameof(deco), deco, null);
     }
 }
Example #21
0
        public Tank(float xPos, float yPos)
            : base(xPos, yPos)
        {
            Console.WriteLine("simpleTank");
            _image = new Image("Resources/tank.png");
            _image.CenterOrigin();
            AddGraphic(_image);
            Weapon = new Weapon(this);
            Weapon.addDecorator(ProjectileDecorators.TestBullet);
            Weapon.addDecorator(ProjectileDecorators.BulletWallCollider);

            //define this entity as part of the game pause group
            Group = (int)PauseGroups.NotMenu;

            //logic can now be instantiated here already
            Logic = new ProtoLogic(this);
        }
Example #22
0
 public SpeedUp(ITankLogic pLogic)
     : base(pLogic)
 {
     Tank._speed += 5;
 }
Example #23
0
 public ControlWasd(ITankLogic pLogic)
     : base(pLogic)
 {
 }
Example #24
0
 public UsePowerUps(ITankLogic pLogic) : base(pLogic)
 {
 }
Example #25
0
 public SpeedUp(ITankLogic pLogic) : base(pLogic)
 {
     Tank._speed += 5;
 }