Exemplo n.º 1
0
 /// <summary>
 /// Remove attack targer Game.Military.RemoveAttackTarget is called
 /// </summary>
 public static void RemoveAttackTarget(Game.Military m, Character c)
 {
     military.RemoveAttackTarget(c);
 }
Exemplo n.º 2
0
        /// <summary>
        /// Adds attack targets from save file
        /// </summary>
        /// <param name="m"></param>
        /// <param name="reader"></param>
        public static void LoadTargets(Game.Military m, BinaryReader reader)
        {
            // Need to get attack targets only. Since reflection can't differentiate between attack and defend targets without using the
            // field name (field name may change between releases since it's obfuscated), read them from the save file
            var readerPosition = reader.BaseStream.Position;

            reader.BaseStream.Seek(militaryPosition, SeekOrigin.Begin);

            int num = reader.ReadInt32();

            for (int i = 0; i < num; i++)
            {
                new Uniform(reader);
            }

            num = reader.ReadInt32();
            for (int i = 0; i < num; i++)
            {
                new SquadPosition(reader, m);
            }

            num = reader.ReadInt32();
            for (int i = 0; i < num; i++)
            {
                new Formation(reader, m);
            }

            num = reader.ReadInt32();
            for (int i = 0; i < num; i++)
            {
                new GuardStation(reader);
            }

            num = reader.ReadInt32();
            for (int i = 0; i < num; i++)
            {
                ReadPatrolRoute(reader);    // PatrolRoute constructor modifies the map object, so manually progress the reader position
            }
            if (GnomanEmpire.Instance.LoadingSaveVersion >= 4)
            {
                num = reader.ReadInt32();
                for (int i = 0; i < num; i++)
                {
                    ReadTrainingStation(reader);    // TrainingStation constructor modifies the map object, so manually progress the reader position
                }
            }

            GameEntityManager entityManager = GnomanEmpire.Instance.EntityManager;

            num = reader.ReadInt32();
            for (int i = 0; i < num; i++)
            {
                Character character = entityManager.Entity(reader.ReadUInt32()) as Character;

                if (character != null)
                {
                    military.AddTarget(character);
                }
            }

            reader.BaseStream.Seek(readerPosition, SeekOrigin.Begin);
        }
Exemplo n.º 3
0
 /// <summary>
 /// Override Game.Military.FindAttackTarget
 /// </summary>
 public static Character FindAttackTarget(Game.Military m, Character c)
 {
     return(military.FindAttackTarget(c));
 }