Beispiel #1
0
 // Update is called once per frame
 public void Update()
 {
     UpdateHealth();
     if (isTurn)
     {
         if (!hasMoved && numActions > 0 && Input.GetMouseButtonDown(0) && TileMousePos.IsValid())
         {
             hasMoved = true;
             numActions--;
             targetPos = new Vector3(TileMousePos.mousePos.x, this.transform.position.y, TileMousePos.mousePos.z);
             List <Vector3> path = pathfind.FindPath(this.transform.position, targetPos);
             rom.SetPoints(path);
             rom.move = true;
         }
         if (this.transform.position == targetPos)
         {
             rom.move = false;
             pathfind.Reset();
         }
         if (numActions <= 0)
         {
             EndTurn();
         }
     }
 }
Beispiel #2
0
 // Update is called once per frame
 public void Update()
 {
     if (isTurn)
     {
         if (!hasMoved && numActions > 0)
         {
             hasMoved = true;
             numActions--;
             //Move Enemy in this priority
             //1)Move to range of player if player is visible
             //2)Move to unexplored area of map
             //3)Revisit explored areas of map
             targetPos = new Vector3(GetRandXPos(), this.transform.position.y, GetRandZPos());
             List <Vector3> path = pathfind.FindPath(this.transform.position, targetPos);
             rom.SetPoints(path);
             rom.move = true;
         }
         if (this.transform.position == targetPos)
         {
             rom.move = false;
             pathfind.Reset();
         }
         if (numActions <= 0)
         {
             EndTurn();
         }
     }
 }