Example #1
0
        //--------------
        //--------------
        //--------------
        public void init(Gajo pai, WalkingMode type)
        {
            walkingMode = type;
            initializeGajo();//super
            _pai = pai;

            if (walker.Navigation.agent.isOnNavMesh)
            {
                walker.target = pai.gameObject.transform.position;
                walker.Navigation.startWalking();
            }

            if (walker.Animacao.gameObject.activeSelf)
            {
                walker.Animacao.SetBool("walk", true); //mexe
            }
            orientation                 = Vector3.zero;
            rotSpeed                    = 0.05f;
            step                        = rotSpeed * Time.deltaTime;
            runningDistance             = walker.Navigation.agent.radius * 4;
            threeQuarterRunningDistance = walker.Navigation.agent.radius * 3;
            halfRunningDistance         = walker.Navigation.agent.radius * 2;

            isReady = true;
        }
Example #2
0
//------------------------------------
#if Reaper
	IEnumerator reaper()	{
			while (true) {

				int i=listaGajos.Count-1;
				for(; i>=0; i--)
				{Gajo g=listaGajos[i];
                 if (g != null)
                    {
                        if (g.iEstado == Gajo.GajoState.MORTO)
                        {
                            listaGajos.Remove(g);
                            //    Destroy(g.gameObject);
                            Destroy(g);
                        }
                    }
				}					
				listaGajos.RemoveAll (delegate (Gajo o) { return o == null; });
				yield return new WaitForSeconds (0.5f);		
			}
		}
        private void recordSystemStateInFileIndividuo()
        {
            timeFrame++;

            Gajo g1 = GajosFactory.listaGajos[0];

            str = "";
            if (g1 != null)
            {
                str += numRun + ",";
                str += timeFrame + ",";
                str += Global.livingGajos + ",";
                str += g1.getId() + ",";
                str += g1.iEstado + ",";
                str += g1.transform.position.x + ",";
                str += g1.transform.position.y + ",";
                str += g1.transform.position.z + ",";
                if (g1.iEstado == Gajo.GajoState.VIVO)
                {
                    str += g1.behavior.psy.mood.x + ",";
                }
                else
                {
                    str += "nul" + ",";
                }
                if (g1.iEstado == Gajo.GajoState.VIVO)
                {
                    str += g1.behavior.psy.mood.y + ",";
                }
                else
                {
                    str += "nul" + ",";
                }
                if (g1.iEstado == Gajo.GajoState.VIVO)
                {
                    str += g1.behavior.psy.mood.z + ",";
                }
                else
                {
                    str += "nul" + ",";
                }

                str += g1.behavior.Interacao.Memoria.duracaoMediaInteracoes + ",";

                //s += g1.whatAmIDoing + ",";
                if (g1.iEstado == Gajo.GajoState.VIVO)
                {
                    switch (g1.behavior.myMarkov.currentState)
                    {
                    case 0: str += "Still"; break;

                    case 1: str += "Move"; break;

                    case 2: str += "Move"; break;

                    case 3: str += "Wander"; break;

                    case 4: str += "Attempt_Social_Start"; break;

                    case 5: str += "Attempt_Social_Win"; break;

                    case 6: str += "Attempt_Social_Lose"; break;

                    case 7:
                        if (g1.behavior.dispatcher.lastActionPerformed == 5)
                        {
                            str += "Attempt_Social_Win";
                        }
                        else
                        if (g1.behavior.dispatcher.lastActionPerformed == 6)
                        {
                            str += "Attempt_Social_Lose";
                        }
                        else
                        {
                            str += "Attempt_Social_End";
                        }
                        break;

                    case 8: str += "Trade_Begin"; break;

                    case 9: str += "Trade_Win"; break;

                    case 10: str += "Trade_Lose"; break;

                    case 11:
                        if (g1.behavior.dispatcher.lastActionPerformed == 9)
                        {
                            str += "Trade_Win";
                        }
                        else
                        if (g1.behavior.dispatcher.lastActionPerformed == 10)
                        {
                            str += "Trade_Lose";
                        }
                        else
                        {
                            str += "Trade_End";
                        }
                        break;

                    case 12:
                        str += "Move";
                        break;
                    }
                }
                else
                {
                    str += "Move";
                }
                str += ",";
                //deprecated          if (g1.iEstado == "vivo")
                //deprecated                s += g1.walker.Navigation.MaxSpeed + ",";
                //deprecated            else s += "nul" + ",";
                //deprecated        if (g1.iEstado == "vivo")
                //deprecated        s += g1.walker.Navigation.MaxNeighbours + ",";
                //deprecated        else s += "nul" + ",";
                //deprecated        if (g1.iEstado == "vivo")
                //deprecated        s += g1.walker.Navigation.NeighboursDist + ",";
                //deprecated        else s += "nul" + ",";
                //deprecated        if (g1.iEstado == "vivo")
                //deprecated        s += g1.walker.Navigation.Radius + ",";
                //deprecated        else s += "nul" + ",";
                if (g1.iEstado == Gajo.GajoState.VIVO)
                {
                    str += g1.behavior.psy.emotion.x + ",";
                }
                else
                {
                    str += "nul" + ",";
                }
                if (g1.iEstado == Gajo.GajoState.VIVO)
                {
                    str += g1.behavior.psy.emotion.y + ",";
                }
                else
                {
                    str += "nul" + ",";
                }
                if (g1.iEstado == Gajo.GajoState.VIVO)
                {
                    str += g1.behavior.psy.emotion.z + ",";
                }
                else
                {
                    str += "nul" + ",";
                }
                if (g1.iEstado == Gajo.GajoState.VIVO)
                {
                    str += g1.behavior.psy.personality.x + ",";
                }
                else
                {
                    str += "nul" + ",";
                }
                if (g1.iEstado == Gajo.GajoState.VIVO)
                {
                    str += g1.behavior.psy.personality.y + ",";
                }
                else
                {
                    str += "nul" + ",";
                }
                if (g1.iEstado == Gajo.GajoState.VIVO)
                {
                    str += g1.behavior.psy.personality.z + ",";
                }
                else
                {
                    str += "nul" + ",";
                }

                //--//
                if (g1.iEstado == Gajo.GajoState.VIVO)
                {
                    str += g1.metabolism.energy + ",";
                }
                else
                {
                    str += "nul" + ",";
                }
                if (g1.iEstado == Gajo.GajoState.VIVO)
                {
                    str += g1.metabolism.connectedness + ",";
                }
                else
                {
                    str += "nul" + ",";
                }
                if (g1.iEstado == Gajo.GajoState.VIVO)
                {
                    str += g1.metabolism.chemicals[0] + ",";
                }
                else
                {
                    str += "nul" + ",";
                }
                if (g1.iEstado == Gajo.GajoState.VIVO)
                {
                    str += g1.metabolism.chemicals[1] + ",";
                }
                else
                {
                    str += "nul" + ",";
                }
                if (g1.iEstado == Gajo.GajoState.VIVO)
                {
                    str += g1.metabolism.chemicals[2] + ",";
                }
                else
                {
                    str += "nul" + ",";
                }
                //--//

                /* if (g1.iEstado == Gajo.GajoState.VIVO)
                 *   s += g1.metabolism.ht_testosterone + ",";
                 * else s += "nul" + ",";
                 * if (g1.iEstado == Gajo.GajoState.VIVO)
                 *   s += g1.metabolism.ha_adrenaline + ",";
                 * else s += "nul" + ",";
                 * if (g1.iEstado == Gajo.GajoState.VIVO)
                 *   s += g1.metabolism.hs_serotonin + ",";
                 * else s += "nul" + ",";
                 * if (g1.iEstado == Gajo.GajoState.VIVO)
                 *   s += g1.metabolism.hm_melatonin + ",";
                 * else s += "nul" + ",";
                 * if (g1.iEstado == Gajo.GajoState.VIVO)
                 *   s += g1.metabolism.hl_leptin;
                 * else s += "nul";
                 */
                //--//
                str += "*";
                for (int i = 0; i < g1.blueprint.dna.Length; i++)
                {
                    str += g1.blueprint.dna[i];
                }
                //--//
                str += ",";
                str += g1.behavior.Interacao.Memoria.numeroInteracoes;
                str += ",";
                str += g1.behavior.Interacao.Memoria.totalCooperativeInteractionsW;
                str += ",";
                str += g1.behavior.Interacao.Memoria.totalInteractionsN;
                str += ",";
                switch (g1.behavior.Interacao.Memoria.typeOfInteraction)
                {
                case MemoryOfRelationships.TypeRelationship.VOID:
                    str += "Void";
                    break;

                case MemoryOfRelationships.TypeRelationship.SOCIAL:
                    str += "Social";
                    break;

                case MemoryOfRelationships.TypeRelationship.TRADE:
                    str += "Trade";
                    break;
                }
                str += ",";
                if (g1.iEstado == Gajo.GajoState.VIVO)
                {
                    str += g1.metabolism.blueprint.getP() + ",";
                }
                else
                {
                    str += "nul" + ",";
                }
                if (g1.iEstado == Gajo.GajoState.VIVO)
                {
                    str += g1.metabolism.blueprint.getA() + ",";
                }
                else
                {
                    str += "nul" + ",";
                }
                if (g1.iEstado == Gajo.GajoState.VIVO)
                {
                    str += g1.metabolism.blueprint.getD() + ",";
                }
                else
                {
                    str += "nul" + ",";
                }
                if (g1.iEstado == Gajo.GajoState.VIVO)
                {
                    str += g1.metabolism.blueprint.getEnergyTolerance() + ",";
                }
                else
                {
                    str += "nul" + ",";
                }
                if (g1.iEstado == Gajo.GajoState.VIVO)
                {
                    str += g1.metabolism.blueprint.getConnectedness() + ",";
                }
                else
                {
                    str += "nul" + ",";
                }
                if (g1.iEstado == Gajo.GajoState.VIVO)
                {
                    str += g1.metabolism.blueprint.getSleepCycle() + ",";
                }
                else
                {
                    str += "nul" + ",";
                }
            }
            writerIndividuo.WriteLine(str);
        }