Exemple #1
0
            public GameObject(int id, string name, Game1 game, float X, float Y, bool AcceptInput, Vector2 ColliderDimentions, Vector2 ColliderOffset, bool ColliderIsTrigger, bool HasAI, int Team, float MaxSpeed, float Acceleration, float MaxHealth, float DamageOnTouch)
            {
                Id = id;

                Name = name;

                Game = game;

                this.Team = Team;

                InputManeger = new Components.InputManeger(this);

                PositionComponent = new Components.PositionComponent(X, Y, AcceptInput, MaxSpeed, Acceleration, this);

                ColliderComponent = new Components.ColliderComponent(ColliderDimentions, ColliderOffset, ColliderIsTrigger, this);

                SpriteComponent = new Components.SpriteComponent(this);

                if (MaxHealth > 0)
                {
                    HealthComponent = new Components.HealthComponent(MaxHealth, DamageOnTouch, this);
                }

                if (HasAI)
                {
                    AI = new Components.AI(Team, this);
                }
            }
 public SpawnSystem(int res_width, int res_height)
 {   /* Sets game res. to custom size (Depending on current Map-Size)*/
     this.RES_WIDTH   = res_width;
     this.RES_HEIGHT  = res_height;
     this.x_coord     = 0;
     this.y_coord     = 0;
     village_position = new Components.PositionComponent(0, 0);
 }
        public Components.PositionComponent Spawn(EntityType entity_type)
        {   /* Determines Spawn Locations for each specific entity */
            this.x_coord = 0;
            this.y_coord = 0;

            switch (entity_type)
            {                        /*Determines entity type*/
            case EntityType.Village: //Spawn @middle of map
                ComputeVillageCoord();
                break;

            case EntityType.Meteor:         //Spawn @map-edge
                ComputeMeteorCoord();
                break;

            case EntityType.Lightning:      //Spawn @Anywhere (Excluding Village)
                ComputeLighteningCoord();
                break;
            }

            Components.PositionComponent new_position = new Components.PositionComponent(this.x_coord, this.y_coord);   //Creates Spawn Position/Location

            return(new_position);
        }
 public SpawnSystem()
 {   /* Sets game res. to 1920*1080px by default */
     this.x_coord     = 0;
     this.y_coord     = 0;
     village_position = new Components.PositionComponent(0, 0);
 }