// Start is called before the first frame update void Start() { inicio = goal.transform.position; estados = new List <State>(); List <Transition> chaseTrans = new List <Transition>(); chaseTrans.Add(new AlcanzadoTrans(yo, negro, goal, inicio, "Esperando")); chaseTrans.Add(new disponibleTrans(verde, azul, negro, "Esperando")); ChaseState fs = new ChaseState(yo, negro, chaseTrans, maxA); fs.SetName("Persiguiendo Negro"); estados.Add(fs); List <Transition> esperandoTrans = new List <Transition>(); esperandoTrans.Add(new CargadoTrans(negro, "Persiguiendo Negro")); esperandoTrans.Add(new CargadoTrans(azul, "Persiguiendo Azul")); esperandoTrans.Add(new CargadoTrans(verde, "Persiguiendo Verde")); esperandoState ss = new esperandoState(esperandoTrans); ss.SetName("Esperando"); estados.Add(ss); List <Transition> chaseTrans1 = new List <Transition>(); chaseTrans1.Add(new AlcanzadoTrans(yo, azul, goal, inicio, "Esperando")); chaseTrans1.Add(new disponibleTrans(verde, azul, negro, "Esperando")); ChaseState ts = new ChaseState(yo, azul, chaseTrans1, maxA); ts.SetName("Persiguiendo Azul"); estados.Add(ts); List <Transition> chaseTrans2 = new List <Transition>(); chaseTrans2.Add(new AlcanzadoTrans(yo, verde, goal, inicio, "Esperando")); chaseTrans2.Add(new disponibleTrans(verde, azul, negro, "Esperando")); ChaseState fos = new ChaseState(yo, verde, chaseTrans2, maxA); fos.SetName("Persiguiendo Verde"); estados.Add(fos); estadoActual = ss; }
// Start is called before the first frame update void Start() { GameObject go = new GameObject(); go.transform.position = meta; Agent ag = go.AddComponent <Agent>() as Agent; inicio = yo.transform.position; GameObject go1 = new GameObject(); go1.transform.position = inicio; Agent ag1 = go1.AddComponent <Agent>() as Agent; estados = new List <State>(); List <Transition> buscandoTrans = new List <Transition>(); buscandoTrans.Add(new waitingForFoodTrans(otro1, otro2, "Esperando")); buscandoTrans.Add(new tookFoodTrans(yo, ag, "Cargado")); ChaseState fs = new ChaseState(yo, ag, buscandoTrans, maxA); fs.SetName("Buscando"); estados.Add(fs); List <Transition> cargadoTrans = new List <Transition>(); cargadoTrans.Add(new depositadoTrans(yo, ag1, "Buscando")); cargadoTrans.Add(new intersectadoTrans(yo, "Buscando")); cargadoState ss = new cargadoState(yo, ag1, cargadoTrans, maxA); ss.SetName("Cargado"); estados.Add(ss); List <Transition> esperandoTrans = new List <Transition>(); esperandoTrans.Add(new disponibleTrans(yo, otro1, otro2, "Buscando")); esperandoState ts = new esperandoState(esperandoTrans); ts.SetName("Esperando"); estados.Add(ts); estadoActual = fs; }