Esempio n. 1
0
    void OnTriggerEnter(Collider col)
    {
        if (col.tag == "Player")
        {
            if (TriggerWayPoints == null)
            {
                Debug.Log("inside way piints");
                isTriggerPredict           = true;
                decision.predictionTrigger = true;
                TriggerCount++;
                TriggerWayPoints = this.gameObject;
            }
            else if (TriggerWayPoints.transform.GetComponent <PredictionBH>().isTriggerPredict)
            {
                PredictionBH prediction = TriggerWayPoints.transform.GetComponent <PredictionBH>();

                for (int i = 0; i < prediction.WayPoints.Count; i++)
                {
                    if (this.gameObject != TriggerWayPoints && this.gameObject == prediction.WayPoints[i].PossiblePoints)
                    {
                        prediction.WayPoints[i].Percentages++;
                    }
                }

                isTriggerPredict           = false;
                TriggerWayPoints           = null;
                decision.predictionTrigger = false;
            }
        }
    }
Esempio n. 2
0
    public void PredictionStateAction()
    {
        PredictionBH triggerPoints = PredictionBH.TriggerWayPoints.GetComponent <PredictionBH>();
        int          selectedIndex = 0;
        int          currentCount  = triggerPoints.WayPoints[0].Percentages;

        for (int i = 1; i < triggerPoints.WayPoints.Count; i++)
        {
            if (triggerPoints.WayPoints[i].Percentages != 0)
            {
                if (currentCount < triggerPoints.WayPoints[i].Percentages)
                {
                    currentCount  = triggerPoints.WayPoints[i].Percentages;
                    selectedIndex = i;
                }
            }
        }

        unit.target = triggerPoints.WayPoints[selectedIndex].PossiblePoints.transform;
        lookAround.StartLookAround();
    }