.
This commit is contained in:
parent
3ce46a72f1
commit
6dfd44119d
@ -3033,7 +3033,7 @@ MonoBehaviour:
|
|||||||
canBeAttacked: 1
|
canBeAttacked: 1
|
||||||
canBuildHere: 1
|
canBuildHere: 1
|
||||||
buildingOnTile: {fileID: 0}
|
buildingOnTile: {fileID: 0}
|
||||||
tileOwnerIndex: 2
|
tileOwnerIndex: 0
|
||||||
whoCanEasyGetTile: 0
|
whoCanEasyGetTile: 0
|
||||||
isBorderTile: 0
|
isBorderTile: 0
|
||||||
--- !u!1 &281753801 stripped
|
--- !u!1 &281753801 stripped
|
||||||
@ -11739,7 +11739,7 @@ MonoBehaviour:
|
|||||||
canBeAttacked: 1
|
canBeAttacked: 1
|
||||||
canBuildHere: 1
|
canBuildHere: 1
|
||||||
buildingOnTile: {fileID: 0}
|
buildingOnTile: {fileID: 0}
|
||||||
tileOwnerIndex: 2
|
tileOwnerIndex: 0
|
||||||
whoCanEasyGetTile: 0
|
whoCanEasyGetTile: 0
|
||||||
isBorderTile: 0
|
isBorderTile: 0
|
||||||
--- !u!1001 &955721060
|
--- !u!1001 &955721060
|
||||||
@ -13263,8 +13263,8 @@ MonoBehaviour:
|
|||||||
canBeAttacked: 1
|
canBeAttacked: 1
|
||||||
canBuildHere: 1
|
canBuildHere: 1
|
||||||
buildingOnTile: {fileID: 0}
|
buildingOnTile: {fileID: 0}
|
||||||
tileOwnerIndex: 2
|
tileOwnerIndex: 0
|
||||||
whoCanEasyGetTile: 0
|
whoCanEasyGetTile: 2
|
||||||
isBorderTile: 0
|
isBorderTile: 0
|
||||||
--- !u!1001 &1081702126
|
--- !u!1001 &1081702126
|
||||||
PrefabInstance:
|
PrefabInstance:
|
||||||
@ -14975,7 +14975,7 @@ MonoBehaviour:
|
|||||||
canBeAttacked: 1
|
canBeAttacked: 1
|
||||||
canBuildHere: 1
|
canBuildHere: 1
|
||||||
buildingOnTile: {fileID: 0}
|
buildingOnTile: {fileID: 0}
|
||||||
tileOwnerIndex: 0
|
tileOwnerIndex: 2
|
||||||
whoCanEasyGetTile: 0
|
whoCanEasyGetTile: 0
|
||||||
isBorderTile: 0
|
isBorderTile: 0
|
||||||
--- !u!1001 &1189553016
|
--- !u!1001 &1189553016
|
||||||
@ -19108,7 +19108,7 @@ MonoBehaviour:
|
|||||||
canBeAttacked: 1
|
canBeAttacked: 1
|
||||||
canBuildHere: 1
|
canBuildHere: 1
|
||||||
buildingOnTile: {fileID: 0}
|
buildingOnTile: {fileID: 0}
|
||||||
tileOwnerIndex: 0
|
tileOwnerIndex: 2
|
||||||
whoCanEasyGetTile: 0
|
whoCanEasyGetTile: 0
|
||||||
isBorderTile: 0
|
isBorderTile: 0
|
||||||
--- !u!1001 &1539306586
|
--- !u!1001 &1539306586
|
||||||
@ -21172,7 +21172,7 @@ GameObject:
|
|||||||
m_Icon: {fileID: 0}
|
m_Icon: {fileID: 0}
|
||||||
m_NavMeshLayer: 0
|
m_NavMeshLayer: 0
|
||||||
m_StaticEditorFlags: 0
|
m_StaticEditorFlags: 0
|
||||||
m_IsActive: 1
|
m_IsActive: 0
|
||||||
--- !u!4 &1657916562
|
--- !u!4 &1657916562
|
||||||
Transform:
|
Transform:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -23051,8 +23051,8 @@ MonoBehaviour:
|
|||||||
m_Script: {fileID: 11500000, guid: 4b3c4882af86905429c1c42aabf068c1, type: 3}
|
m_Script: {fileID: 11500000, guid: 4b3c4882af86905429c1c42aabf068c1, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
neutralCaptureTime: 1
|
neutralCaptureTime: 0.3
|
||||||
enemyCaptureTime: 2
|
enemyCaptureTime: 0.5
|
||||||
fastCaptureTime: 0
|
fastCaptureTime: 0
|
||||||
_playerState: {fileID: 0}
|
_playerState: {fileID: 0}
|
||||||
--- !u!114 &1801060025
|
--- !u!114 &1801060025
|
||||||
@ -23453,7 +23453,7 @@ GameObject:
|
|||||||
m_Icon: {fileID: 0}
|
m_Icon: {fileID: 0}
|
||||||
m_NavMeshLayer: 0
|
m_NavMeshLayer: 0
|
||||||
m_StaticEditorFlags: 0
|
m_StaticEditorFlags: 0
|
||||||
m_IsActive: 1
|
m_IsActive: 0
|
||||||
--- !u!4 &1819395262
|
--- !u!4 &1819395262
|
||||||
Transform:
|
Transform:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -24178,7 +24178,7 @@ MonoBehaviour:
|
|||||||
canBeAttacked: 1
|
canBeAttacked: 1
|
||||||
canBuildHere: 1
|
canBuildHere: 1
|
||||||
buildingOnTile: {fileID: 0}
|
buildingOnTile: {fileID: 0}
|
||||||
tileOwnerIndex: 0
|
tileOwnerIndex: 2
|
||||||
whoCanEasyGetTile: 0
|
whoCanEasyGetTile: 0
|
||||||
isBorderTile: 0
|
isBorderTile: 0
|
||||||
--- !u!1 &1866725373 stripped
|
--- !u!1 &1866725373 stripped
|
||||||
@ -26279,7 +26279,7 @@ MonoBehaviour:
|
|||||||
canBuildHere: 1
|
canBuildHere: 1
|
||||||
buildingOnTile: {fileID: 0}
|
buildingOnTile: {fileID: 0}
|
||||||
tileOwnerIndex: 0
|
tileOwnerIndex: 0
|
||||||
whoCanEasyGetTile: 0
|
whoCanEasyGetTile: 2
|
||||||
isBorderTile: 0
|
isBorderTile: 0
|
||||||
--- !u!1001 &1996405558
|
--- !u!1001 &1996405558
|
||||||
PrefabInstance:
|
PrefabInstance:
|
||||||
|
@ -86,6 +86,7 @@ public class AI_Input : MonoBehaviour
|
|||||||
if (_currentFollowingPath == null)
|
if (_currentFollowingPath == null)
|
||||||
{
|
{
|
||||||
StartPatrolBehaviour();
|
StartPatrolBehaviour();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
MoveTo(_currentFollowingPath[1]);
|
MoveTo(_currentFollowingPath[1]);
|
||||||
}
|
}
|
||||||
@ -143,7 +144,7 @@ public class AI_Input : MonoBehaviour
|
|||||||
|
|
||||||
private void AttackEnemy(PlayerState currentEnemy)
|
private void AttackEnemy(PlayerState currentEnemy)
|
||||||
{
|
{
|
||||||
Debug.Log("attacking");
|
//Debug.Log("attacking");
|
||||||
leftInput = Vector2.zero;
|
leftInput = Vector2.zero;
|
||||||
_currentFollowingPath.Clear();
|
_currentFollowingPath.Clear();
|
||||||
//_actionManager.AttackEnemyOnTile(currentEnemy.currentTile);
|
//_actionManager.AttackEnemyOnTile(currentEnemy.currentTile);
|
||||||
@ -194,7 +195,7 @@ public class AI_Input : MonoBehaviour
|
|||||||
if (!endTile.canMove)
|
if (!endTile.canMove)
|
||||||
{
|
{
|
||||||
endTile = TileManagment.GetRandomOtherTile(_playerState.ownerIndex);
|
endTile = TileManagment.GetRandomOtherTile(_playerState.ownerIndex);
|
||||||
Debug.Log("changed target");
|
//Debug.Log("changed target");
|
||||||
}
|
}
|
||||||
var currentTile = _playerState.currentTile;
|
var currentTile = _playerState.currentTile;
|
||||||
_currentFollowingPath.Clear();
|
_currentFollowingPath.Clear();
|
||||||
@ -220,7 +221,7 @@ public class AI_Input : MonoBehaviour
|
|||||||
{
|
{
|
||||||
while (_currentEnemy)
|
while (_currentEnemy)
|
||||||
{
|
{
|
||||||
Debug.Log("try attack");
|
//Debug.Log("try attack");
|
||||||
_actionManager.AttackEnemyOnTile(_currentEnemy.currentTile);
|
_actionManager.AttackEnemyOnTile(_currentEnemy.currentTile);
|
||||||
yield return new WaitForSeconds(attackCoolDown);
|
yield return new WaitForSeconds(attackCoolDown);
|
||||||
}
|
}
|
||||||
|
@ -103,7 +103,7 @@ public class PlayerActionManager : MonoBehaviour
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Debug.Log("failed attack");
|
//Debug.Log("failed attack");
|
||||||
OnActionEnd?.Invoke(ActionType.Attack, _playerState.currentState);
|
OnActionEnd?.Invoke(ActionType.Attack, _playerState.currentState);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -142,7 +142,7 @@ public class PlayerActionManager : MonoBehaviour
|
|||||||
OnActionEnd?.Invoke(ActionType.Attack, CharacterState.Idle);
|
OnActionEnd?.Invoke(ActionType.Attack, CharacterState.Idle);
|
||||||
OnActionSuccess?.Invoke();
|
OnActionSuccess?.Invoke();
|
||||||
_target = null;
|
_target = null;
|
||||||
Debug.Log(action.actionType + " ended");
|
//Debug.Log(action.actionType + " ended");
|
||||||
}
|
}
|
||||||
|
|
||||||
public float GetProgress()
|
public float GetProgress()
|
||||||
|
@ -147,8 +147,7 @@ public class TileManagment : MonoBehaviour
|
|||||||
|
|
||||||
public static List<TileInfo> GetAllAdjacentTiles(TileInfo currentTile)
|
public static List<TileInfo> GetAllAdjacentTiles(TileInfo currentTile)
|
||||||
{
|
{
|
||||||
List<TileInfo> allTiles = new List<TileInfo>();
|
List<TileInfo> allTiles = new List<TileInfo>();
|
||||||
//int notMyTiles = 0;
|
|
||||||
foreach (Vector3 dir in basicDirections)
|
foreach (Vector3 dir in basicDirections)
|
||||||
{
|
{
|
||||||
var tile = GetTile(currentTile.tilePosition + dir * tileOffset);
|
var tile = GetTile(currentTile.tilePosition + dir * tileOffset);
|
||||||
@ -156,15 +155,14 @@ public class TileManagment : MonoBehaviour
|
|||||||
{
|
{
|
||||||
allTiles.Add(tile);
|
allTiles.Add(tile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//Debug.Log("We have " + notMyTiles + " not my tiles around " + currentTile.name);
|
|
||||||
return allTiles;
|
return allTiles;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<TileInfo> GetAllAdjacentTiles(TileInfo currentTile, TileOwner ownerIndex)
|
public static List<TileInfo> GetAllAdjacentTiles(TileInfo currentTile, TileOwner ownerIndex)
|
||||||
{
|
{
|
||||||
List<TileInfo> allTiles = new List<TileInfo>();
|
List<TileInfo> allTiles = new List<TileInfo>();
|
||||||
//int notMyTiles = 0;
|
|
||||||
foreach (Vector3 dir in basicDirections)
|
foreach (Vector3 dir in basicDirections)
|
||||||
{
|
{
|
||||||
var tile = GetTile(currentTile.tilePosition + dir * tileOffset);
|
var tile = GetTile(currentTile.tilePosition + dir * tileOffset);
|
||||||
@ -172,8 +170,7 @@ public class TileManagment : MonoBehaviour
|
|||||||
{
|
{
|
||||||
allTiles.Add(tile);
|
allTiles.Add(tile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//Debug.Log("We have " + notMyTiles + " not my tiles around " + currentTile.name);
|
|
||||||
return allTiles;
|
return allTiles;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -202,15 +199,35 @@ public class TileManagment : MonoBehaviour
|
|||||||
|
|
||||||
public static void CheckSurroundedTiles(List<TileInfo> tiles, TileOwner ownerIndex, TileInfo startTile)
|
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> 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)
|
foreach (TileInfo tile in firstAdjacentTiles)
|
||||||
{
|
{
|
||||||
SetSurroundedTiles(tiles, ownerIndex, tile);
|
SetSurroundedTiles(tiles, ownerIndex, tile);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
public static void SetSurroundedTiles(List<TileInfo> tiles, TileOwner ownerIndex, TileInfo startTile)
|
public static void SetSurroundedTiles(List<TileInfo> tiles, TileOwner ownerIndex, TileInfo startTile)
|
||||||
{
|
{
|
||||||
@ -221,7 +238,7 @@ public class TileManagment : MonoBehaviour
|
|||||||
|
|
||||||
while (q.Count > 0)
|
while (q.Count > 0)
|
||||||
{
|
{
|
||||||
var tile = q.Dequeue();
|
var tile = q.Dequeue();
|
||||||
//Debug.Log("current tile " + tile.name);
|
//Debug.Log("current tile " + tile.name);
|
||||||
|
|
||||||
if (q.Count > tiles.Count)
|
if (q.Count > tiles.Count)
|
||||||
@ -232,6 +249,11 @@ public class TileManagment : MonoBehaviour
|
|||||||
if (tile.isBorderTile) //we are in a wrong area
|
if (tile.isBorderTile) //we are in a wrong area
|
||||||
{
|
{
|
||||||
//Debug.Log("FindBorder");
|
//Debug.Log("FindBorder");
|
||||||
|
/*foreach (TileInfo t in surroundedTiles)
|
||||||
|
{
|
||||||
|
//t.whoCanEasyGetTile = ownerIndex;
|
||||||
|
t.whoCanEasyGetTile = TileOwner.Neutral;
|
||||||
|
}*/
|
||||||
surroundedTiles.Clear();
|
surroundedTiles.Clear();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -242,13 +264,14 @@ public class TileManagment : MonoBehaviour
|
|||||||
}
|
}
|
||||||
|
|
||||||
surroundedTiles.Add(tile);
|
surroundedTiles.Add(tile);
|
||||||
//tile.isChecked = true;
|
/*if(tile.whoCanEasyGetTile != TileOwner.Neutral)
|
||||||
|
tile.whoCanEasyGetTile = TileOwner.Neutral;*/
|
||||||
|
|
||||||
var adjacentTiles = GetOtherTiles(tile, ownerIndex);
|
var adjacentTiles = GetOtherTiles(tile, ownerIndex);
|
||||||
//Debug.Log("second tiles "+ adjacentTiles.Count);
|
//Debug.Log("second tiles "+ adjacentTiles.Count);
|
||||||
foreach (TileInfo newTile in adjacentTiles)
|
foreach (TileInfo newTile in adjacentTiles)
|
||||||
{
|
{
|
||||||
q.Enqueue(newTile);
|
q.Enqueue(newTile);
|
||||||
}
|
}
|
||||||
|
|
||||||
iterations++;
|
iterations++;
|
||||||
@ -260,6 +283,6 @@ public class TileManagment : MonoBehaviour
|
|||||||
{
|
{
|
||||||
tile.whoCanEasyGetTile = ownerIndex;
|
tile.whoCanEasyGetTile = ownerIndex;
|
||||||
}
|
}
|
||||||
//Debug.Log("Surrounded " + surroundedTiles.Count);
|
Debug.Log("Surrounded " + surroundedTiles.Count);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user