4 пункт. Без невидимости.

This commit is contained in:
DyatelO 2021-11-09 12:32:45 +03:00
parent 996ddc93f9
commit 6bf411c227
5 changed files with 124 additions and 8 deletions

View File

@ -113,8 +113,8 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: f701310aaea215a4d9e0c8646d3e1ecd, type: 3}
m_Name:
m_EditorClassIdentifier:
nextTileMoveTime: 0.5
moveDistance: 1
nextTileMoveTime: 0.25
moveDistance: 0
moveVFX: {fileID: 0}
--- !u!114 &8834890311105204210
MonoBehaviour:
@ -181,8 +181,8 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
maxAttackEnergy: 3.1
attackResetTime: 2
attackCost: 3
attackResetTime: 2.5
attackCost: 0
--- !u!114 &1406732623307280272
MonoBehaviour:
m_ObjectHideFlags: 0
@ -231,7 +231,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
isAIActive: 1
botState: 1
botState: 2
leftInput: {x: 0, y: 0}
rightInput: {x: 0, y: 0}
agressiveTime: 30000
@ -239,7 +239,7 @@ MonoBehaviour:
updateBehaviourIn: 0.6
neutralCapDistance: 6
detectDistance: 3
bonusDetectDistance: 8
bonusDetectDistance: 0
attackPlayerDistance: 2
bonusPlaceColdown: 4
protectionDistance: 2

View File

@ -82,8 +82,8 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
owner: 0
velocity: 15
damage: 380
velocity: 20
damage: 440
--- !u!114 &1813624109411210032
MonoBehaviour:
m_ObjectHideFlags: 0

View File

@ -71,6 +71,7 @@ public class PlayerState : MonoBehaviour
foreach (PlayerState player in players)
{
// && player.ownerIndex != gameObject.GetComponent<PlayerState>().ownerIndex
// (enemies.Count < _towerCount + 3)
if ((enemies.Count < _towerCount + 1)
&&
FindObjectOfType<ToweHealthController>() != null

View 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);
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 940264f60c891e8459dc4d90015a0290
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: