// Use this for initialization
    void Start()
    {
        graph = new Pathfinding();
        graph.Load("PathfindingRodrigueTest");
        graph.setNeighbors();

        target = GameObject.FindGameObjectWithTag("Target");
        road = PathfindingManager.GetInstance().GetRoad(transform.position, target.transform.position, graph);
        road = PathfindingManager.GetInstance().SmoothRoad(road);

        canShoot = true;
        //targetPossible = GameObject.FindGameObjectsWithTag("Target");
        //foreach (GameObject temp in targetPossible)
        //{
        //    if (temp != this.gameObject)
        //    {
        //        //if(temp.transform.parent.GetComponent<TeamNumber>().teamName != "RektByRodrigue")
        //        //{
        //        listOfTarget.Add(temp);
        //        //}
        //    }
        //}
        ////InvokeRepeating("GetTarget", 0.5f, 0.5f);
        //currentTarget = targetPossible[0];
        spawnPoint = transform.position;
        rateOfFire = 1;
        //InvokeRepeating("FindTarget", 0.1f, 0.1f);
        InvokeRepeating("UpdateRoad", 0.5f, 0.5f);
    }
 public JordanMoveTask()
 {
     //Select your pathfinding
     graph = new Pathfinding();
     graph.Load("Windywyll");
     graph.setNeighbors();
     delayTimerUpdateRoad = 1.0f;
     startTimerUpdateRoad = Time.time;
 }
    // Use this for initialization
    void Start()
    {
        //Select your pathfinding
        graph = new Pathfinding();
        graph.Load("BenoitV");
        graph.setNeighbors();
        //

        road = PathfindingManager.GetInstance().GetRoad(transform.position, target.transform.position,graph);
        InvokeRepeating("UpdateRoad", 0.5f,1f);
        Debug.Log(PathfindingManager.GetInstance().test);
    }
Example #4
0
    // Use this for initialization
    void Start()
    {
        //Select your pathfinding
        graph = new Pathfinding();
        graph.Load("PoulpeNavMesh");
        graph.setNeighbors();
        //

        target = GameObject.FindGameObjectWithTag("Target");
        road = PathfindingManager.GetInstance().GetRoad(transform.position, target.transform.position,graph);
        InvokeRepeating("UpdateRoad", 0.5f, 0.5f);
        Debug.Log(PathfindingManager.GetInstance().test);
    }
Example #5
0
    public SW_Walk(int id, float pSpeed, float pRange, string graphName)
        : base(id)
    {
        target = TeamManagerWill.instance.mainTarget;
        closeEnoughRange = pRange;
        speed = pSpeed;
        graph = new Pathfinding();
        graph.Load(graphName);
        graph.setNeighbors();

        player = TeamManagerWill.instance.members[idAgent].gameObject;
        playerController = player.GetComponent<CharacterController>();
        road = PathfindingManager.GetInstance().GetRoad(player.transform.position, target.transform.position, graph);
        road = PathfindingManager.GetInstance().SmoothRoad(road);
    }
    // Use this for initialization
    void Start()
    {
        //Select your pathfinding
        graph = new Pathfinding();
        graph.Load("Windywyll");
        graph.setNeighbors();
        //

        GameObject[] temp = GameObject.FindGameObjectsWithTag("Target");
        enemies = new List<GameObject>(temp);
        enemies.Remove(gameObject);

        target = enemies[Random.Range(0, enemies.Count)];
        road = PathfindingManager.GetInstance().GetRoad(transform.position, target.transform.position, graph);
        InvokeRepeating("UpdateRoad", 0.5f, 0.5f);
        Debug.Log(PathfindingManager.GetInstance().test);
    }
    // Use this for initialization
    void Start()
    {
        //theStateMachine = new StateMachineAntoine(gameObject);

        graph = new Pathfinding();
        graph.Load("antoinePathFinding");
        graph.setNeighbors();

        SpawnPos = transform.position;

        //int rand = Random.Range(0, nodes.transform.childCount - 1);

        //target = nodes.transform.GetChild(rand).gameObject;

        //PathPoint = points[index].transform.position;

        enemies = GameObject.FindGameObjectsWithTag("Target");

        for (int i = 0; i < enemies.Length; i++)
        {
            if (enemies[i] == gameObject)
            {
                enemies[i] = null;
            }
            else if (enemies[i] == bro1)
            {
                enemies[i] = null;
            }
            else if (enemies[i] == bro2)
            {
                enemies[i] = null;
            }
        }

        InvokeRepeating("ChangeColor", 0.5f, 0.1f);

        InvokeRepeating("FindNewTarget", 0f, 0.5f);

        InvokeRepeating("Calc", 0f, 1.0f);

        isMoving = false;
        isShooting = false;
        canShoot = true;
        bullet = Resources.Load("Bullet") as GameObject;
        finished = false;

        decisionTree = new SelectorAntoine();
        SequenceAntoine s1 = new SequenceAntoine();
        FiltreAntoine f1 = new FiltreAntoine(DelegateInvertBool);
        TaskAntoineDelegate delegateSeePlayer = new TaskAntoineDelegate(HaveTarget);
        SelectorAntoine se1 = new SelectorAntoine();
        SequenceAntoine s2 = new SequenceAntoine();
        TaskAntoineDelegate delegateCanShoot = new TaskAntoineDelegate(GetCanShootDelegate);
        TaskAntoineDelegate delegateShootBullet = new TaskAntoineDelegate(ShootBullet);
        TaskAntoineDelegate delegateDodge = new TaskAntoineDelegate(DelegateDodge);
        SelectorAntoine se2 = new SelectorAntoine();
        SequenceAntoine s4 = new SequenceAntoine();
        TaskAntoineDelegate delegateDistance = new TaskAntoineDelegate(DelegateDistance);
        TaskAntoineDelegate delegateChase = new TaskAntoineDelegate(DelegateChase);
        TaskAntoineDelegate delegatePatrol = new TaskAntoineDelegate(DelegatePatrol);

        decisionTree.AddNode(s1);
        decisionTree.AddNode(se2);

        //s1.AddNode(f1);
        s1.AddNode(delegateSeePlayer);
        s1.AddNode(se1);

        // f1.AddNode(delegateSeePlayer);

        se1.AddNode(s2);
        se1.AddNode(delegateDodge);

        s2.AddNode(delegateCanShoot);
        s2.AddNode(delegateShootBullet);

        se2.AddNode(s4);
        se2.AddNode(delegatePatrol);

        s4.AddNode(delegateDistance);
        s4.AddNode(delegateChase);
    }
    // Use this for initialization
    void Start()
    {
        agent = GetComponent<NavMeshAgent>();

        graph = new Pathfinding();
        graph.Load("benPath");
        graph.setNeighbors();

        bulletSpeed = bullet.GetComponent<bulletScript>().speed;

        shootSequence.AddTask(new BenjaminBehaviorTree.ChooseTargetTask(this));
        shootSequence.AddTask(new BenjaminBehaviorTree.CanShootCondition(this));
        shootSequence.AddTask(new BenjaminBehaviorTree.ShootTask(this));
        moveToTarget.AddTask(new BenjaminBehaviorTree.IsTargetValidCondition(this));
        moveToTarget.AddTask(new BenjaminBehaviorTree.MoveToTask(this));
        //moveToRandom.AddTask(new GetRandomNavigationPointTask(this));
        //moveToRandom.AddTask(new MoveToTask(this));
        behaviorTree.AddTask(shootSequence);
        behaviorTree.AddTask(moveToTarget);
        //behaviorTree.AddTask(moveToRandom);

        spawn = transform.position;
        Debug.Log("start");
        Debug.Log(1 << 20);
        InvokeRepeating("UpdateRoad", 0f, 0.5f);
    }
    // Use this for initialization
    void Start()
    {
        //Select your pathfinding
        graph = new Pathfinding();
        graph.Load("benPath");
        graph.setNeighbors();
        //

        RefreshTargets();
        target = targets[Random.Range(0, targets.Count)];
        sm = new StateMachine();
        sm.controller = gameObject;
        sm.SetCurrentState(new MoveToState());

        spawn = transform.position;

        /*
        //Select your pathfinding
        graph = new Pathfinding();
        graph.Load(PlayerPrefs.GetString("Pierre"));
        graph.setNeighbors();
        //

        target = GameObject.FindGameObjectWithTag("Target");
        road = PathfindingManager.GetInstance().GetRoad(transform.position, target.transform.position, graph);
        Debug.Log(PathfindingManager.GetInstance().test);

        */
    }