4 пункт. Без невидимости.
This commit is contained in:
parent
996ddc93f9
commit
6bf411c227
@ -113,8 +113,8 @@ MonoBehaviour:
|
|||||||
m_Script: {fileID: 11500000, guid: f701310aaea215a4d9e0c8646d3e1ecd, type: 3}
|
m_Script: {fileID: 11500000, guid: f701310aaea215a4d9e0c8646d3e1ecd, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
nextTileMoveTime: 0.5
|
nextTileMoveTime: 0.25
|
||||||
moveDistance: 1
|
moveDistance: 0
|
||||||
moveVFX: {fileID: 0}
|
moveVFX: {fileID: 0}
|
||||||
--- !u!114 &8834890311105204210
|
--- !u!114 &8834890311105204210
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
@ -181,8 +181,8 @@ MonoBehaviour:
|
|||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
maxAttackEnergy: 3.1
|
maxAttackEnergy: 3.1
|
||||||
attackResetTime: 2
|
attackResetTime: 2.5
|
||||||
attackCost: 3
|
attackCost: 0
|
||||||
--- !u!114 &1406732623307280272
|
--- !u!114 &1406732623307280272
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -231,7 +231,7 @@ MonoBehaviour:
|
|||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
isAIActive: 1
|
isAIActive: 1
|
||||||
botState: 1
|
botState: 2
|
||||||
leftInput: {x: 0, y: 0}
|
leftInput: {x: 0, y: 0}
|
||||||
rightInput: {x: 0, y: 0}
|
rightInput: {x: 0, y: 0}
|
||||||
agressiveTime: 30000
|
agressiveTime: 30000
|
||||||
@ -239,7 +239,7 @@ MonoBehaviour:
|
|||||||
updateBehaviourIn: 0.6
|
updateBehaviourIn: 0.6
|
||||||
neutralCapDistance: 6
|
neutralCapDistance: 6
|
||||||
detectDistance: 3
|
detectDistance: 3
|
||||||
bonusDetectDistance: 8
|
bonusDetectDistance: 0
|
||||||
attackPlayerDistance: 2
|
attackPlayerDistance: 2
|
||||||
bonusPlaceColdown: 4
|
bonusPlaceColdown: 4
|
||||||
protectionDistance: 2
|
protectionDistance: 2
|
||||||
|
@ -82,8 +82,8 @@ MonoBehaviour:
|
|||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
owner: 0
|
owner: 0
|
||||||
velocity: 15
|
velocity: 20
|
||||||
damage: 380
|
damage: 440
|
||||||
--- !u!114 &1813624109411210032
|
--- !u!114 &1813624109411210032
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
@ -71,6 +71,7 @@ public class PlayerState : MonoBehaviour
|
|||||||
foreach (PlayerState player in players)
|
foreach (PlayerState player in players)
|
||||||
{
|
{
|
||||||
// && player.ownerIndex != gameObject.GetComponent<PlayerState>().ownerIndex
|
// && player.ownerIndex != gameObject.GetComponent<PlayerState>().ownerIndex
|
||||||
|
// (enemies.Count < _towerCount + 3)
|
||||||
if ((enemies.Count < _towerCount + 1)
|
if ((enemies.Count < _towerCount + 1)
|
||||||
&&
|
&&
|
||||||
FindObjectOfType<ToweHealthController>() != null
|
FindObjectOfType<ToweHealthController>() != null
|
||||||
|
104
Assets/Scripts/Test/TowerAIAttack.cs
Normal file
104
Assets/Scripts/Test/TowerAIAttack.cs
Normal file
@ -0,0 +1,104 @@
|
|||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
public class TowerAIAttack : MonoBehaviour
|
||||||
|
{
|
||||||
|
[SerializeField] private AI_BotController _botController;
|
||||||
|
[SerializeField] private AttackEnergyController _attackEnergyController;
|
||||||
|
private PlayerState _playerState;
|
||||||
|
public float attackPlayerDistance = 2f;
|
||||||
|
public PlayerState _currentEnemy;
|
||||||
|
|
||||||
|
public BotState botState = BotState.Attack;
|
||||||
|
private bool isAttackedOnce = false;
|
||||||
|
|
||||||
|
|
||||||
|
private void Awake() {
|
||||||
|
_botController.botState = botState;
|
||||||
|
}
|
||||||
|
private void Update() {
|
||||||
|
_botController.botState = botState;
|
||||||
|
//_currentEnemy = _botController._currentEnemy;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
private bool IsEnemyEnabledForAttack()
|
||||||
|
{
|
||||||
|
if (isAttackedOnce)
|
||||||
|
return false;
|
||||||
|
if (botState != BotState.Attack && _attackEnergyController.IsReady())
|
||||||
|
{
|
||||||
|
foreach (PlayerState enemy in _playerState.enemies)
|
||||||
|
{
|
||||||
|
if (enemy == null)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (!enemy.gameObject.activeSelf)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
foreach (var dir in TileManagment.basicDirections)
|
||||||
|
{
|
||||||
|
for (int i = 1; i <= attackPlayerDistance; i++)
|
||||||
|
{
|
||||||
|
TileInfo checkTile = TileManagment.GetTile(_playerState.currentTile.tilePosition, dir, i);
|
||||||
|
if (checkTile == null || checkTile.tileOwnerIndex == TileOwner.Neutral)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (enemy.currentTile == checkTile)
|
||||||
|
{
|
||||||
|
_currentEnemy = enemy;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}*/
|
||||||
|
private bool SetNewBotState(BotState newState)
|
||||||
|
{
|
||||||
|
if (botState != newState)
|
||||||
|
{
|
||||||
|
botState = newState;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private IEnumerator CheckBotState(float updateTime)
|
||||||
|
{
|
||||||
|
yield return new WaitForSeconds(UnityEngine.Random.Range(0.5f, 1f));
|
||||||
|
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
|
CheckBotState();
|
||||||
|
yield return new WaitForSeconds(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CheckBotState()
|
||||||
|
{
|
||||||
|
//Debug.Log("CheckState");
|
||||||
|
BotState newBotState;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
newBotState = BotState.Attack;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
SetNewBotState(newBotState);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
11
Assets/Scripts/Test/TowerAIAttack.cs.meta
Normal file
11
Assets/Scripts/Test/TowerAIAttack.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 940264f60c891e8459dc4d90015a0290
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
Loading…
x
Reference in New Issue
Block a user