// Start is called before the first frame update void Start() { //DATOS DE PERSONAJE kineticsAgent = agent.kineticsAgent; steeringAgent = agent.steeringAgent; //ARRIVE INITIALIZATION enemy = GameObject.Find(enemyName).GetComponent <static_data>(); kineticsEnemy = enemy.kineticsAgent; arrive = new Arrive(kineticsAgent, kineticsEnemy, maxAccelerationArrive, agent.maxspeed, targetRadiusArrive, slowRadiusArrive, timeTotargetArrive); arrive.weigth = 1f; //AVOID INITIALIZATION obstacles = GameObject.FindGameObjectsWithTag("Obstacle"); for (int i = 0; i < obstacles.Length; i++) { obs_trans.Add(obstacles[i].transform); } Transform[] obstacles_transforms = obs_trans.ToArray(); obstacleAvoidance = new ObstacleAvoidance(kineticsAgent, obstacles_transforms, avoidDistance, lookAheadAvoid, steeringAgent); obstacleAvoidance.weigth = 1f; //FACE INITIALIZATION face = new Face(kineticsAgent, kineticsEnemy); face.weigth = 1f; //BLEND INITIALIZATION behaviorsArrive[0] = arrive; behaviorsArrive[1] = face; behaviorsAvoid[0] = obstacleAvoidance; blendArrive = new BlendedSteering(behaviorsArrive, maxAccelBlend, maxAngularBlend); blendAvoid = new BlendedSteering(behaviorsAvoid, maxAccelBlend, maxAngularBlend); //PRIORITY INITIALIZATION groups[0] = blendAvoid;//OJO avoid tiene prioridad por eso va primero groups[1] = blendArrive; priority = new PrioritySteering(groups, steeringAgent); }
// Start is called before the first frame update void Start() { //Inicializamos las estructuras necesarias de otros componentes enemy = GameObject.Find(enemyName).GetComponent <static_data>(); kineticsEnemy = enemy.kineticsAgent; kineticsAgent = agent.kineticsAgent; steeringAgent = agent.steeringAgent; face = new Face(kineticsAgent, kineticsEnemy); }
void Start() { //Inicializamos las estructuras necesarias de otros componentes enemy = GameObject.Find(enemyName).GetComponent <static_data>(); kineticsEnemy = enemy.kineticsAgent; kineticsAgent = agent.kineticsAgent; steeringAgent = agent.steeringAgent; //Inicializamos movimientos kinematicSeek = new KinematicSeek(kineticsAgent, kineticsEnemy, maxSeekSpeed); }
void Start() { //Inicializamos las estructuras necesarias de otros componentes enemy = GameObject.Find(enemyName).GetComponent <static_data>(); kineticsEnemy = enemy.kineticsAgent; kineticsAgent = agent.kineticsAgent; steeringAgent = agent.steeringAgent; //Inicializamos movimientos pursue = new Pursue(kineticsAgent, kineticsEnemy, maxPrediction); }
void Start() { //Inicializamos las estructuras necesarias de otros componentes enemy = GameObject.Find(enemyName).GetComponent <static_data>(); kineticsEnemy = enemy.kineticsAgent; kineticsAgent = agent.kineticsAgent; steeringAgent = agent.steeringAgent; //Inicializamos movimientos velMatch = new VelocityMatch(kineticsAgent, kineticsEnemy, MaxAcceleration, timeTotarget); }
// Start is called before the first frame update void Start() { //Inicializamos las estructuras necesarias de otros componentes enemy = GameObject.Find(enemyName).GetComponent <static_data>(); kineticsEnemy = enemy.kineticsAgent; kineticsAgent = agent.kineticsAgent; steeringAgent = agent.steeringAgent; //Inicializamos movimientos align = new Align(kineticsAgent, kineticsEnemy, maxAngularAccel, maxRotation, targetRadius, slowRadius, timeToTarget); }
void Start() { //Inicializamos las estructuras necesarias de otros componentes enemy = GameObject.Find(enemyName).GetComponent <static_data>(); kineticsEnemy = enemy.kineticsAgent; kineticsAgent = agent.kineticsAgent; steeringAgent = agent.steeringAgent; maxspeed = agent.maxspeed; //Inicializamos movimientos kinematicArrive = new KinematicArrive(kineticsAgent, kineticsEnemy, maxSeekSpeed, timeTotarget, radius); }
void Start() { //Inicializamos las estructuras necesarias de otros componentes enemy = GameObject.Find(enemyName).GetComponent <static_data>(); kineticsEnemy = enemy.kineticsAgent; kineticsAgent = agent.kineticsAgent; steeringAgent = agent.steeringAgent; maxspeed = agent.maxspeed; //Inicializamos movimientos arrive = new Arrive(kineticsAgent, kineticsEnemy, MaxAcceleration, maxspeed, targetRadius, slowRadius, timeTotarget); }
public UpdateMaxSpeed(static_data CharacterData, float NewSpeed) { characterData = CharacterData; newSpeed = NewSpeed; }
// Start is called before the first frame update void Start() { //DATOS DE PERSONAJE kineticsAgent = agent.kineticsAgent; steeringAgent = agent.steeringAgent; //SEPARATION INITIALIZATION //buscamos a todos los pokemones GameObject[] allPokemons = GameObject.FindGameObjectsWithTag("Pokemon"); //vamos a usar solo los pokemones que participan en flock GameObject[] pokemons = Array.FindAll(allPokemons, c => c.GetComponent <static_data>().flocker); //Inicializamos las estructuras necesarias de otros componentes for (int i = 0; i < pokemons.Length; i++) { if (pokemons[i].name != name) //solo me interesan los pokemones que no son yo { targets_kin_sepa.Add(pokemons[i].GetComponent <static_data>().kineticsAgent); } } Kinetics[] targets_sep = targets_kin_sepa.ToArray(); separation = new Separation(kineticsAgent, targets_sep, threshold, maxAccelSep); separation.weigth = 3f; //VELOCITY MATCH INITIALIZATION enemyVel = GameObject.Find(enemyNameVel).GetComponent <static_data>(); kineticsEnemyVel = enemyVel.kineticsAgent; velMatch = new VelocityMatch(kineticsAgent, kineticsEnemyVel, MaxAccelVel, timeTotargetVel); velMatch.weigth = 1f; //COHESION INITIALIZATION //Inicializamos las estructuras necesarias de otros componentes for (int i = 0; i < pokemons.Length; i++) { targets_trans_cohe.Add(pokemons[i].transform); } Transform[] targets_cohe = targets_trans_cohe.ToArray(); maxSpeedCohe = agent.maxspeed; cohesion = new Cohesion(kineticsAgent, targets_cohe, maxAccelCohe, maxSpeedCohe, targetRadiusCohe, slowRadiusCohe, timeToTargetCohe); cohesion.weigth = 1.5f; //BLEND INITIALIZATION //mezclamos nuestros comportamientos para crear fllock behaviors[0] = separation; behaviors[1] = velMatch; behaviors[2] = cohesion; blendFlock = new BlendedSteering(behaviors, maxAccelBlend, maxAngularBlend); }