This commit is contained in:
AlexMamontow 2021-08-09 00:49:16 +03:00
parent 3ce46a72f1
commit 6dfd44119d
5 changed files with 400 additions and 42 deletions

View File

@ -3033,7 +3033,7 @@ MonoBehaviour:
canBeAttacked: 1
canBuildHere: 1
buildingOnTile: {fileID: 0}
tileOwnerIndex: 2
tileOwnerIndex: 0
whoCanEasyGetTile: 0
isBorderTile: 0
--- !u!1 &281753801 stripped
@ -11739,7 +11739,7 @@ MonoBehaviour:
canBeAttacked: 1
canBuildHere: 1
buildingOnTile: {fileID: 0}
tileOwnerIndex: 2
tileOwnerIndex: 0
whoCanEasyGetTile: 0
isBorderTile: 0
--- !u!1001 &955721060
@ -13263,8 +13263,8 @@ MonoBehaviour:
canBeAttacked: 1
canBuildHere: 1
buildingOnTile: {fileID: 0}
tileOwnerIndex: 2
whoCanEasyGetTile: 0
tileOwnerIndex: 0
whoCanEasyGetTile: 2
isBorderTile: 0
--- !u!1001 &1081702126
PrefabInstance:
@ -14975,7 +14975,7 @@ MonoBehaviour:
canBeAttacked: 1
canBuildHere: 1
buildingOnTile: {fileID: 0}
tileOwnerIndex: 0
tileOwnerIndex: 2
whoCanEasyGetTile: 0
isBorderTile: 0
--- !u!1001 &1189553016
@ -19108,7 +19108,7 @@ MonoBehaviour:
canBeAttacked: 1
canBuildHere: 1
buildingOnTile: {fileID: 0}
tileOwnerIndex: 0
tileOwnerIndex: 2
whoCanEasyGetTile: 0
isBorderTile: 0
--- !u!1001 &1539306586
@ -21172,7 +21172,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
m_IsActive: 0
--- !u!4 &1657916562
Transform:
m_ObjectHideFlags: 0
@ -23051,8 +23051,8 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 4b3c4882af86905429c1c42aabf068c1, type: 3}
m_Name:
m_EditorClassIdentifier:
neutralCaptureTime: 1
enemyCaptureTime: 2
neutralCaptureTime: 0.3
enemyCaptureTime: 0.5
fastCaptureTime: 0
_playerState: {fileID: 0}
--- !u!114 &1801060025
@ -23453,7 +23453,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
m_IsActive: 0
--- !u!4 &1819395262
Transform:
m_ObjectHideFlags: 0
@ -24178,7 +24178,7 @@ MonoBehaviour:
canBeAttacked: 1
canBuildHere: 1
buildingOnTile: {fileID: 0}
tileOwnerIndex: 0
tileOwnerIndex: 2
whoCanEasyGetTile: 0
isBorderTile: 0
--- !u!1 &1866725373 stripped
@ -26279,7 +26279,7 @@ MonoBehaviour:
canBuildHere: 1
buildingOnTile: {fileID: 0}
tileOwnerIndex: 0
whoCanEasyGetTile: 0
whoCanEasyGetTile: 2
isBorderTile: 0
--- !u!1001 &1996405558
PrefabInstance:

View File

@ -86,6 +86,7 @@ public class AI_Input : MonoBehaviour
if (_currentFollowingPath == null)
{
StartPatrolBehaviour();
return;
}
MoveTo(_currentFollowingPath[1]);
}
@ -143,7 +144,7 @@ public class AI_Input : MonoBehaviour
private void AttackEnemy(PlayerState currentEnemy)
{
Debug.Log("attacking");
//Debug.Log("attacking");
leftInput = Vector2.zero;
_currentFollowingPath.Clear();
//_actionManager.AttackEnemyOnTile(currentEnemy.currentTile);
@ -194,7 +195,7 @@ public class AI_Input : MonoBehaviour
if (!endTile.canMove)
{
endTile = TileManagment.GetRandomOtherTile(_playerState.ownerIndex);
Debug.Log("changed target");
//Debug.Log("changed target");
}
var currentTile = _playerState.currentTile;
_currentFollowingPath.Clear();
@ -220,7 +221,7 @@ public class AI_Input : MonoBehaviour
{
while (_currentEnemy)
{
Debug.Log("try attack");
//Debug.Log("try attack");
_actionManager.AttackEnemyOnTile(_currentEnemy.currentTile);
yield return new WaitForSeconds(attackCoolDown);
}

View File

@ -103,7 +103,7 @@ public class PlayerActionManager : MonoBehaviour
}
else
{
Debug.Log("failed attack");
//Debug.Log("failed attack");
OnActionEnd?.Invoke(ActionType.Attack, _playerState.currentState);
}
}
@ -142,7 +142,7 @@ public class PlayerActionManager : MonoBehaviour
OnActionEnd?.Invoke(ActionType.Attack, CharacterState.Idle);
OnActionSuccess?.Invoke();
_target = null;
Debug.Log(action.actionType + " ended");
//Debug.Log(action.actionType + " ended");
}
public float GetProgress()

View File

@ -148,7 +148,6 @@ public class TileManagment : MonoBehaviour
public static List<TileInfo> GetAllAdjacentTiles(TileInfo currentTile)
{
List<TileInfo> allTiles = new List<TileInfo>();
//int notMyTiles = 0;
foreach (Vector3 dir in basicDirections)
{
var tile = GetTile(currentTile.tilePosition + dir * tileOffset);
@ -157,14 +156,13 @@ public class TileManagment : MonoBehaviour
allTiles.Add(tile);
}
}
//Debug.Log("We have " + notMyTiles + " not my tiles around " + currentTile.name);
return allTiles;
}
public static List<TileInfo> GetAllAdjacentTiles(TileInfo currentTile, TileOwner ownerIndex)
{
List<TileInfo> allTiles = new List<TileInfo>();
//int notMyTiles = 0;
foreach (Vector3 dir in basicDirections)
{
var tile = GetTile(currentTile.tilePosition + dir * tileOffset);
@ -173,7 +171,6 @@ public class TileManagment : MonoBehaviour
allTiles.Add(tile);
}
}
//Debug.Log("We have " + notMyTiles + " not my tiles around " + currentTile.name);
return allTiles;
}
@ -202,15 +199,35 @@ public class TileManagment : MonoBehaviour
public static void CheckSurroundedTiles(List<TileInfo> tiles, TileOwner ownerIndex, TileInfo startTile)
{
/*foreach (TileInfo tile in charTiles[(int)ownerIndex])
{
tile.whoCanEasyGetTile = TileOwner.Neutral;
}*/
List<TileInfo> firstAdjacentTiles = GetOtherTiles(startTile, ownerIndex);
List<TileInfo> firstAllAdjacentTiles = GetAllAdjacentTiles(startTile);
List<TileOwner> differentOwners = new List<TileOwner>();
/*foreach (TileInfo tile in firstAllAdjacentTiles)
{
if (!differentOwners.Contains(tile.tileOwnerIndex) && tile.tileOwnerIndex != TileOwner.Neutral)
{
differentOwners.Add(tile.tileOwnerIndex);
}
}*/
//Debug.Log(differentOwners.Count);
/*foreach (var tileOwnerIndex in differentOwners)
{
foreach (TileInfo tile in firstAllAdjacentTiles)
{
if (tile.tileOwnerIndex != tileOwnerIndex)
{
SetSurroundedTiles(tiles, tileOwnerIndex, tile);
}
}
}*/
foreach (TileInfo tile in firstAdjacentTiles)
{
SetSurroundedTiles(tiles, ownerIndex, tile);
}
}
public static void SetSurroundedTiles(List<TileInfo> tiles, TileOwner ownerIndex, TileInfo startTile)
{
@ -232,6 +249,11 @@ public class TileManagment : MonoBehaviour
if (tile.isBorderTile) //we are in a wrong area
{
//Debug.Log("FindBorder");
/*foreach (TileInfo t in surroundedTiles)
{
//t.whoCanEasyGetTile = ownerIndex;
t.whoCanEasyGetTile = TileOwner.Neutral;
}*/
surroundedTiles.Clear();
return;
}
@ -242,7 +264,8 @@ public class TileManagment : MonoBehaviour
}
surroundedTiles.Add(tile);
//tile.isChecked = true;
/*if(tile.whoCanEasyGetTile != TileOwner.Neutral)
tile.whoCanEasyGetTile = TileOwner.Neutral;*/
var adjacentTiles = GetOtherTiles(tile, ownerIndex);
//Debug.Log("second tiles "+ adjacentTiles.Count);
@ -260,6 +283,6 @@ public class TileManagment : MonoBehaviour
{
tile.whoCanEasyGetTile = ownerIndex;
}
//Debug.Log("Surrounded " + surroundedTiles.Count);
Debug.Log("Surrounded " + surroundedTiles.Count);
}
}

File diff suppressed because one or more lines are too long