// 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);
    }
Example #2
0
    // 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);
    }
Example #3
0
    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);
    }
Example #4
0
    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);
    }
Example #5
0
    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);
    }
Example #6
0
    // 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);
    }
Example #7
0
    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);
    }
Example #8
0
    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);
    }
Example #9
0
 public UpdateMaxSpeed(static_data CharacterData, float NewSpeed)
 {
     characterData = CharacterData;
     newSpeed      = NewSpeed;
 }
Example #10
0
    // 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);
    }