Ejemplo n.º 1
0
 /// <summary>
 /// Sets a new spawner effect
 /// </summary>
 /// <param name="newSpawner">New spawner effect</param>
 public void ResetSpawner(SpawnerEffect newSpawner)
 {
   Spawner = newSpawner;
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Creates a new instance of the GameEffect class using the serialized data
 /// </summary>
 /// <param id="line">String array containing the serialized data</param>
 /// <param id="position">Current position in the array</param>
 /// <param id="context">Context of the serialized data, game where this INetworkSerializable object is in</param>
 /// <returns>GameEffect created using the provided serialized data</returns>
 public static GameEffect Create(string[] line, ref int position, WildmenGame context)
 {
   GameEffect e = null;
   EffectTypes et = (EffectTypes)int.Parse(line[position++]);
   switch (et)
   {
     case EffectTypes.Scripted:
       e = new GameEffect();
       break;
     case EffectTypes.UnitDeath:
       e = new UnitDeathEffect();
       break;
     case EffectTypes.ScrollText:
       e = new ScrollTextEffect();
       break;
     case EffectTypes.Animation:
       e = new AnimationEffect();
       break;
     case EffectTypes.Spawner:
       e = new SpawnerEffect();
       break;
     default:
       throw new Exception("Unknown effect");
   }
   e.game = context;
   e.Deserialize(MessageType.GameEffectCreate, line, ref position, context);
   return e;
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Starts unit spawning of given unit at given speed
 /// </summary>
 /// <param name="spawnee"></param>
 /// <param name="speed"></param>
 public void StartUnitSpawner(UnitDb spawnee, int speed)
 {
   SpawnerEffect spawner = new SpawnerEffect(this, spawnee, Owner, MapPosition, speed);
   Spawner = spawner;
   spawner.Initialize(game, NearestTile);
   this.game.Effects.Add(spawner);
   game.SendData(Network.MakeServerMessage(MessageType.GameEffectCreate, spawner));
 }