Fer912
05-28-2012, 05:27 PM
good morning again to see if someone can lend a hand, I created a mission style coop, which still could not test and so the code is not okay.
My intention is to bring together in an array all the local pilots and remote mission, I wonder if there is any advice on what is written or modified to improve it or fix it thanks
using System;
using System.Collections.Generic;
using maddox.core;
using maddox.game;
using maddox.game.world;
using maddox.GP;
public class Mission : AMission
{
bool _WonSup = true; // wonSup se da con el 75% de los pilotos vivos, cada avion volable vale 12.5
bool _WonEsc = true; // wonEsc se da con el +50% de los aviones de ataques vivos
bool _WonATK = false; // wonATK se da con +60% de los blancos asignados destruidos
int indice = 0;
private class piloto
{
string _nombre;
string _estado;
int _valor;
public string Nombre
{
set { this._nombre = value; }
get { return this._nombre; }
}
public string Estado
{
get { return this._estado; }
set { this._estado = value; }
}
public int Valor
{
set { this._valor = value; }
get { return this._valor; }
}
};
piloto[] p = new piloto[8];
public override void OnTrigger(int missionNumber, string shortName, bool active)
{
base.OnTrigger(missionNumber, shortName, active);
if ("WonEsc".Equals(shortName) && active)
{
_WonEsc = false;
GamePlay.gpGetTrigger("WonEsc").Enable = false;
GamePlay.gpHUDLogCenter("WonEsc Fallido");
}
if ("WonAtk".Equals(shortName) && active)
{
_WonATK = true;
GamePlay.gpGetTrigger("WonAtk").Enable = false;
GamePlay.gpHUDLogCenter("WonAtk Cumplido");
}
}
public override void OnActorCreated(int missionNumber, string shortName, AiActor actor)
{
base.OnActorCreated(missionNumber, shortName, actor);
if (actor is AiAircraft)
{
for (int i = 0; i < (actor as AiAircraft).Places(); i++ )
{
if ((actor as AiAircraft).Player(i) != null)
{
p[indice].Nombre = (actor as AiAircraft).Player(i).Name();
p[indice].Estado = "Vivo";
p[indice].Valor = 0; //por ahora no lo uso, va a ser implementado en otros para los defectos del avion segun las tirada de dados de rol
indice++;
}
}
}
}
public override void OnActorDead(int missionNumber, string shortName, AiActor actor, List<DamagerScore> damages)
{
base.OnActorDead(missionNumber, shortName, actor, damages);
if (actor is AiAircraft)
{
GamePlay.gpLogServer(null, " Paso 1 Ok ", null);
for (int i = 0; i < (actor as AiAircraft).Places(); i++)
{
GamePlay.gpLogServer(null, "Primer For i={0}", new object[] { i });
GamePlay.gpLogServer(null, " Paso 2 Ok ", null);
// if ((actor as AiAircraft).Player(i) != null)
//{
for (int j = 0; j < indice; j++)
{
GamePlay.gpLogServer(null, " Buscando al Piloto Ok ", null);
if (p[j].Nombre.Equals((actor as AiAircraft).Player(i).Name()))
{
p[j].Estado = "Muerto";
GamePlay.gpLogServer(null, "piloto {0} ha muerto JAJAJ", new object[] { p[j].Nombre });
}
}
//}
}
}
}
}
My intention is to bring together in an array all the local pilots and remote mission, I wonder if there is any advice on what is written or modified to improve it or fix it thanks
using System;
using System.Collections.Generic;
using maddox.core;
using maddox.game;
using maddox.game.world;
using maddox.GP;
public class Mission : AMission
{
bool _WonSup = true; // wonSup se da con el 75% de los pilotos vivos, cada avion volable vale 12.5
bool _WonEsc = true; // wonEsc se da con el +50% de los aviones de ataques vivos
bool _WonATK = false; // wonATK se da con +60% de los blancos asignados destruidos
int indice = 0;
private class piloto
{
string _nombre;
string _estado;
int _valor;
public string Nombre
{
set { this._nombre = value; }
get { return this._nombre; }
}
public string Estado
{
get { return this._estado; }
set { this._estado = value; }
}
public int Valor
{
set { this._valor = value; }
get { return this._valor; }
}
};
piloto[] p = new piloto[8];
public override void OnTrigger(int missionNumber, string shortName, bool active)
{
base.OnTrigger(missionNumber, shortName, active);
if ("WonEsc".Equals(shortName) && active)
{
_WonEsc = false;
GamePlay.gpGetTrigger("WonEsc").Enable = false;
GamePlay.gpHUDLogCenter("WonEsc Fallido");
}
if ("WonAtk".Equals(shortName) && active)
{
_WonATK = true;
GamePlay.gpGetTrigger("WonAtk").Enable = false;
GamePlay.gpHUDLogCenter("WonAtk Cumplido");
}
}
public override void OnActorCreated(int missionNumber, string shortName, AiActor actor)
{
base.OnActorCreated(missionNumber, shortName, actor);
if (actor is AiAircraft)
{
for (int i = 0; i < (actor as AiAircraft).Places(); i++ )
{
if ((actor as AiAircraft).Player(i) != null)
{
p[indice].Nombre = (actor as AiAircraft).Player(i).Name();
p[indice].Estado = "Vivo";
p[indice].Valor = 0; //por ahora no lo uso, va a ser implementado en otros para los defectos del avion segun las tirada de dados de rol
indice++;
}
}
}
}
public override void OnActorDead(int missionNumber, string shortName, AiActor actor, List<DamagerScore> damages)
{
base.OnActorDead(missionNumber, shortName, actor, damages);
if (actor is AiAircraft)
{
GamePlay.gpLogServer(null, " Paso 1 Ok ", null);
for (int i = 0; i < (actor as AiAircraft).Places(); i++)
{
GamePlay.gpLogServer(null, "Primer For i={0}", new object[] { i });
GamePlay.gpLogServer(null, " Paso 2 Ok ", null);
// if ((actor as AiAircraft).Player(i) != null)
//{
for (int j = 0; j < indice; j++)
{
GamePlay.gpLogServer(null, " Buscando al Piloto Ok ", null);
if (p[j].Nombre.Equals((actor as AiAircraft).Player(i).Name()))
{
p[j].Estado = "Muerto";
GamePlay.gpLogServer(null, "piloto {0} ha muerto JAJAJ", new object[] { p[j].Nombre });
}
}
//}
}
}
}
}