Beispiel #1
0
 public EnergyTank()
 {
     m_room_key = new RoomKey();
     m_energy_tank_id = -1;
     m_position = new Point3d();
     m_energy = 0;
     m_faction = GameConstants.eFaction.neutral;
 }
Beispiel #2
0
 public EnergyTank()
 {
     m_room_key       = new RoomKey();
     m_energy_tank_id = -1;
     m_position       = new Point3d();
     m_energy         = 0;
     m_faction        = GameConstants.eFaction.neutral;
 }
Beispiel #3
0
 public EnergyTankData()
 {
     energy_tank_id = -1;
     energy         = 0;
     ownership      = GameConstants.eFaction.neutral;
     position       = new Point3d();
     boundingBox    = new AABB3d();
     room_key       = new RoomKey();
 }
Beispiel #4
0
    protected override void ParseParameters(JsonData parameters)
    {
        base.ParseParameters(parameters);

        EnergyTankId      = JsonUtilities.ParseInt(parameters, "energy_tank_id");
        EnergyTankFaction = JsonUtilities.ParseEnum <GameConstants.eFaction>(parameters, "energy_tank_faction");
        HackerId          = JsonUtilities.ParseInt(parameters, "hacker_id");
        HackerFaction     = JsonUtilities.ParseEnum <GameConstants.eFaction>(parameters, "hacker_faction");
    }
Beispiel #5
0
 public GameEvent_EnergyTankHacked()
     : base()
 {
     EventType         = GameEvent.eEventType.energy_tank_hacked;
     EnergyTankId      = -1;
     EnergyTankFaction = GameConstants.eFaction.neutral;
     HackerId          = -1;
     HackerFaction     = GameConstants.eFaction.neutral;
 }
 public EnergyTankData()
 {
     energy_tank_id = -1;
     energy = 0;
     ownership = GameConstants.eFaction.neutral;
     position = new Point3d();
     boundingBox = new AABB3d();
     room_key = new RoomKey();
 }
 public void RefeshEntityProperties(
     Mob ownerMob,
     IEnvironmentEntity entity)
 {
     this.position_x = entity.Position.x;
     this.position_y = entity.Position.y;
     this.position_z = entity.Position.z;
     this.faction    = entity.Faction;
     this.energy     = entity.Energy;
     this.health     = entity.Health;
     this.distance   = Point2d.Distance(ownerMob.Position, entity.Position);
 }
Beispiel #8
0
        public static void UpdateEnergyTankOwnership(
            AsyncRPGDataContext db_context,
            int energyTankID,
            GameConstants.eFaction newOwnership)
        {
            var energyTankQuery =
                (from e in db_context.EnergyTanks
                 where e.EnergyTankID == energyTankID
                 select e).SingleOrDefault();

            energyTankQuery.Ownership = (int)newOwnership;

            db_context.SubmitChanges();
        }
        public EntityProp()
        {
            this.target_object_id = -1;

            this.position_x = 0.0;
            this.position_y = 0.0;
            this.position_z = 0.0;
            this.faction    = GameConstants.eFaction.neutral;
            this.energy     = 0;
            this.health     = 0;
            this.distance   = 0.0f;

            this.propStatus          = EntityProp.ePropStatus.unacknowledged;
            this.propStatusTurnCount = 0;
            this.salience            = 0.0f;
            this.visibilityFlags     = new TypedFlags <EntityProp.ePropVisibilityFlags>();
        }
Beispiel #10
0
        public bool MobHackEnergyTank(EnergyTank energyTank)
        {
            bool success = true;

            float min_distance_squared = WorldConstants.ROOM_TILE_SIZE * WorldConstants.ROOM_TILE_SIZE;

            // Move to the energy tank first if it's too far away
            if (Point3d.DistanceSquared(mob.Position, energyTank.Position) > min_distance_squared)
            {
                success = MoveMob(energyTank.Position);
            }

            if (success)
            {
                // If the energy tank's faction was player it's now neutral
                // If the energy tank's faction was neutral it's now ai
                GameConstants.eFaction newFaction =
                    (energyTank.Faction == GameConstants.eFaction.player)
                    ? GameConstants.eFaction.neutral : GameConstants.eFaction.ai;

                // Update the faction on the energy tank
                energyTank.Faction = newFaction;

                // Post an event that we moved
                output_game_events.Add(
                    new GameEvent_EnergyTankHacked()
                {
                    energy_tank_id      = energyTank.ID,
                    energy_tank_faction = newFaction,
                    hacker_id           = mob.ID,
                    hacker_faction      = GameConstants.eFaction.ai
                });
            }

            return(success);
        }
 public void UpdateState(EnergyTankData energyTankData)
 {
     this.Energy = energyTankData.energy;
     this.Ownership = energyTankData.ownership;
 }
Beispiel #12
0
 public void UpdateState(EnergyTankData energyTankData)
 {
     this.Energy    = energyTankData.energy;
     this.Ownership = energyTankData.ownership;
 }