//------------------------------------------------------------------------------------- public float makeMovement(Vector3 posicaoObjecto) { if (_owner.getId() == Global.whoIsBeingTracked) { Global.whatAmIDoing = TypeOfActionBeingPerformed.MOVE; } _owner.whatAmIDoing = TypeOfActionBeingPerformed.MOVE; float reward = 0; if (posicaoObjecto != Vector3.zero) { _owner.walker.target = posicaoObjecto; _owner.metabolism.energy -= _owner.priceMovement; if (_owner.behavior.psy.mood.x < -0.5 && _owner.behavior.psy.mood.y > 0.5 && _owner.behavior.psy.mood.z < -0.5) { _owner.walker.Navigation.startRunning(); } else { _owner.walker.Navigation.startWalking(); } _owner.behavior.dispatcherSpeed = 1f; } else { wander(); } return(reward); }
//------------------------------------------------------------------------------------------------------- void Update() { if (Global.gameState > 0) { text = ""; GajoCitizen g = CitizenFactory.listaGajos[Global.whoIsBeingTracked]; if (g != null) { text += "\n"; if (g.blueprint != null) { text += "\n Id:" + g.getId() + " Blueprint " + g.blueprint.dna; text += "\n"; } if (g.metabolism != null) { text += "\nEnergy " + g.metabolism.energy; } text += "\nProxemia " + g.proxemia; text += "\nDipatcherSpeed " + g.behavior.dispatcherSpeed; if (g.metabolism != null) { text += "\nChemicals " + g.metabolism.chemicals[0] + " - " + g.metabolism.chemicals[1] + " - " + g.metabolism.chemicals[2] + "\n"; /* text += "\nTestosterona " + g.metabolism.ht_testosterone; * text += "\nAdrenaline " + g.metabolism.ha_adrenaline; * text += "\nLeptine " + g.metabolism.hl_leptin; * text += "\nMelatonin " + g.metabolism.hm_melatonin; * text += "\nSerotonin " + g.metabolism.hs_serotonin; */} text += " "; if (g.walker != null) { text += "Walk Speed:" + g.walker.Animacao.GetFloat("WalkingSpeed"); //change to Movement text += "velocity anim " + g.walker.Animacao.velocity; // text += " ActionAnimation:" + g.walker.animator.GetFloat ("ActionAnimation");//change t } text += "\n Message was dispatched:" + Global.whatAmIDoing; text += "\n"; text += "\n"; if (g.behavior.dispatcher != null) { if (g.behavior.dispatcher != null) { text += g.behavior.getDebugString(); } } //deprecated if (g.walker!=null) //deprecated text += g.walker.Navigation.getDebugString(); } Repaint(); } }
//-------------------------------------------------------------------------------- public void getNextGoalPoint() { if (goalPoints != null) { currentGoalPoint++; if (currentGoalPoint >= goalPoints.Count) { currentGoalPoint = 0; } preferedPosition = (Vector3)goalPoints[currentGoalPoint]; //Debug.DrawLine(transform.position, transform.position + Vector3.up * 25, Color.cyan); } else Debug.LogError("Nao tem goal points!!! " + _owner.getId() + _owner.iEstado); }
//---------------------------------------------------------------------- //---------------------------------------------------------------------- private void hitTest() { int contaProximos = 0; _owner.bNumNeighbours = 0; _owner.bInteractingNeighbours = 0; foreach (GajoCitizen gajo in CitizenFactory.listaGajos) { if (_owner == null) { Destroy(this); return; } else if (gajo != null) { if (gajo.getId() != _owner.getId()) { float dist = Vector3.Distance(_owner.transform.position, gajo.transform.position); if (dist < _owner.hitDistance) { //newActiveMessage("11111101", 0, gajo.transform); Debug.Log("collision"); } if (dist < _owner.hitDistance + 1) { _owner.bInteractingNeighbours++; } if (dist < _owner.proxemia) { contaProximos++; _owner.bNumNeighbours++; } } } } }
//------------------------------------ public int getIndexGajo(GajoCitizen g1) { for (int i = 0; i < listaGajos.Count; i++) if (g1.getId() == listaGajos[i].getId()) return i; return -1; }