Esempio n. 1
0
        private void MoveOverride(List <HexCell> moveCells)
        {
//			bool isLost = UnityEngine.Random.Range(0, 2) == 0;
            bool isLost = NKMRandom.Get(Name, 0, 2) == 0;

            if (!isLost)
            {
                ParentCharacter.DefaultBasicMove(moveCells);
            }
            else
            {
                Active.RemoveMoveCells();
                int movementPoints = ParentCharacter.Speed.Value;
                Active.MoveCells.Add(ParentCharacter.ParentCell);
                HexCell        lastCell    = ParentCharacter.ParentCell;
                List <HexCell> moveTargets = ParentCharacter.GetBasicMoveCells();
                while (movementPoints-- > 0 || !lastCell.IsFreeToStand)
                {
//					List<HexCell> neighborMoveCells = lastCell.GetNeighbors(1,
//						SearchFlags.StopAtEnemyCharacters | SearchFlags.StopAtFriendlyCharacters | SearchFlags.StopAtWalls);
                    List <HexCell> neighborMoveCells = lastCell.GetNeighbors(1).Intersect(moveTargets).ToList();
//					int r = UnityEngine.Random.Range(0, neighborMoveCells.Count);
//					lastCell = neighborMoveCells[r];
                    lastCell = neighborMoveCells.GetRandom();
                    Active.AddMoveCell(lastCell);
                }
                ParentCharacter.DefaultBasicMove(Active.MoveCells);
                Console.Log($"{ParentCharacter.FormattedFirstName()}: Cholera, znowu się zgubili?");
//				int rand = UnityEngine.Random.Range(1, 4);
                int soundID = NKMRandom.Get($"{Name} - ID", 1, 4);
                Active.PlayAudio("op wtf " + soundID);
            }
        }
Esempio n. 2
0
 private void MoveOverride(List <HexCell> moveCells)
 {
     if (UnityEngine.Random.Range(0, 2) == 0)
     {
         ParentCharacter.DefaultBasicMove(moveCells);
     }
     else
     {
         Active.RemoveMoveCells();
         var movementPoints = ParentCharacter.Speed.Value;
         Active.MoveCells.Add(ParentCharacter.ParentCell);
         HexCell lastCell = ParentCharacter.ParentCell;
         while (movementPoints-- != 0)
         {
             List <HexCell> neighborMoveCells = lastCell.GetNeighbors(1, true, true);
             neighborMoveCells.RemoveAll(cell => cell.CharacterOnCell != null); //we don't want to allow stepping into our characters!
             var r = UnityEngine.Random.Range(0, neighborMoveCells.Count);
             lastCell = neighborMoveCells[r];
             Active.AddMoveCell(lastCell);
         }
         ParentCharacter.DefaultBasicMove(Active.MoveCells);
         MessageLogger.Log($"{ParentCharacter.FormattedFirstName()}: Cholera, znowu się zgubili?");
     }
 }