Exemplo n.º 1
0
    //static List<NavPointV2> processedNavPoints;

    void Start()
    {
        if (!staticRef)
        {
            staticRef = this;
        }
        SetRelativePositionVectors();
    }
Exemplo n.º 2
0
 void Update()
 {
     if (myCamera == null && CameraScript.staticInstance != null)
     {
         myCamera = CameraScript.staticInstance.GetComponent <Camera>();
     }
     if (BetterNavNet.allNavPoints.Count > 0)
     {
         nearestNavPoint = BetterNavNet.FindNearestNavpoint(nearestNavPoint, transform.position);
     }
     ProcessRotation();
     ProcessMovement();
 }
Exemplo n.º 3
0
 // Update is called once per frame
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.V))
     {
         isAIEnabled = true;
         nextAItime  = Time.time;
     }
     nearestNavPoint = BetterNavNet.FindNearestNavpoint(nearestNavPoint, this.transform.position);
     if (isAIEnabled)
     {
         AIScript();
     }
 }
Exemplo n.º 4
0
 private void AIDefault()
 {
     velocity = new Vector3(0f, 0f, 0f);
     velocity.Set(velocity.x, 0f, velocity.z);
     rBody.velocity = velocity;
     //if (WithinSightOfPlayer())
     if (isAIEnabled)
     {
         path             = BetterNavNet.FindPath(nearestNavPoint, PlayerMovementAndRotation.nearestNavPoint, i_size);
         pathElementIndex = 0;
         if (path != null)
         {
             LineRenderingThing.staticRef.DrawPath(path);
             behaviourState = EnemyBehaviourState.Pursue;
         }
     }
 }
Exemplo n.º 5
0
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.J) && BetterNavNet.allNavPoints.Count == 0)
        {
            BetterNavNet.CreateNavNet();
            //TestFindAndShowPath.staticRef.keepFindingPathWithBetterNavnet = true;
        }

        //if (keepFindingPathWithBetterNavnet)
        //{

        //NavPointV2 newNearestNavPoint = BetterNavNet.FindNearestNavpoint(nearestNavPoint, this.transform.position);
        //if (nearestNavPoint == null || nearestNavPoint != newNearestNavPoint)
        //{
        //    nearestNavPoint = newNearestNavPoint;
        //}
        //}
    }