protected internal override Steering getSteering(PersonajeBase personaje) { _finishedLinear = _finishedAngular = false; Vector3 newOffset = SimulationManager.DirectionToVector(_target.orientacion + SimulationManager.VectorToDirection(offsetPosition)) * offsetPosition.magnitude; Vector2 destino = SimManagerFinal.positionToGrid(_target.posicion + newOffset); if (destino != lastDestiny) { Vector2 origen = SimManagerFinal.positionToGrid(personaje.posicion); List <Vector3> recorrido = SimManagerFinal.aStarPathV3(origen, destino, personaje.tipo, personaje is PersonajePlayer); lastDestiny = destino; followPath = new PathFollowEndSD(recorrido); } if (followPath.finishedLinear) { personaje.fakeAlign.orientacion = _target.orientacion + offsetOrientation; if (personaje.fakeAlign.orientacion < -System.Math.PI) { personaje.fakeAlign.orientacion += 2 * (float)System.Math.PI; } else if (personaje.fakeAlign.orientacion > System.Math.PI) { personaje.fakeAlign.orientacion -= 2 * (float)System.Math.PI; } personaje.fakeAlign.transform.eulerAngles = new Vector3(0, (_target.orientacion + offsetOrientation) * Bodi.RadianesAGrados, 0); faceSD.target = personaje.fakeAlign; parada.getSteering(personaje); return(faceSD.getSteering(personaje)); } else { return(followPath.getSteering(personaje)); } }
protected internal override void doit() { if (receptor) { destiny = SimManagerFinal.positionToGrid(receptor.posicion); } List <Vector3> camino = SimManagerFinal.aStarPathV3(SimManagerFinal.positionToGrid(sujeto.posicion), destiny, sujeto.tipo, sujeto is PersonajePlayer); recorrer = new PathFollowEndSD(camino); sujeto.newTaskGrid(recorrer); }