Finally bots can die. Player to. And another fixes.
This commit is contained in:
114
Assets/Prefabs/PlayerPrefab/Player.prefab
generated
114
Assets/Prefabs/PlayerPrefab/Player.prefab
generated
@ -1394,10 +1394,9 @@ GameObject:
|
|||||||
- component: {fileID: 2528273238195332182}
|
- component: {fileID: 2528273238195332182}
|
||||||
- component: {fileID: 2528273238195332176}
|
- component: {fileID: 2528273238195332176}
|
||||||
- component: {fileID: 2528273238195332168}
|
- component: {fileID: 2528273238195332168}
|
||||||
- component: {fileID: 2851493361974364939}
|
|
||||||
- component: {fileID: 5170482295850327424}
|
- component: {fileID: 5170482295850327424}
|
||||||
- component: {fileID: 5519976521156458274}
|
- component: {fileID: 8568640505362233545}
|
||||||
- component: {fileID: -4820536401884566159}
|
- component: {fileID: 5876264296742387244}
|
||||||
m_Layer: 10
|
m_Layer: 10
|
||||||
m_Name: Player
|
m_Name: Player
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
@ -1472,7 +1471,7 @@ Animator:
|
|||||||
m_Controller: {fileID: 9100000, guid: 3ebf60422b6cb1c498ee4cf238072b43, type: 2}
|
m_Controller: {fileID: 9100000, guid: 3ebf60422b6cb1c498ee4cf238072b43, type: 2}
|
||||||
m_CullingMode: 1
|
m_CullingMode: 1
|
||||||
m_UpdateMode: 0
|
m_UpdateMode: 0
|
||||||
m_ApplyRootMotion: 0
|
m_ApplyRootMotion: 1
|
||||||
m_LinearVelocityBlending: 0
|
m_LinearVelocityBlending: 0
|
||||||
m_WarningMessage:
|
m_WarningMessage:
|
||||||
m_HasTransformHierarchy: 1
|
m_HasTransformHierarchy: 1
|
||||||
@ -1530,21 +1529,7 @@ MonoBehaviour:
|
|||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
anim: {fileID: 2528273238195332174}
|
anim: {fileID: 2528273238195332174}
|
||||||
canRotate: 1
|
canRotate: 1
|
||||||
--- !u!114 &2851493361974364939
|
isCrouching: 0
|
||||||
MonoBehaviour:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 2528273238195332181}
|
|
||||||
m_Enabled: 1
|
|
||||||
m_EditorHideFlags: 0
|
|
||||||
m_Script: {fileID: 11500000, guid: e5f5f761e43327448b64038300d71e5b, type: 3}
|
|
||||||
m_Name:
|
|
||||||
m_EditorClassIdentifier:
|
|
||||||
enemy: {fileID: 164324136889094180, guid: 2d8d8fcef9fc43144982428bd40ad6f0, type: 3}
|
|
||||||
isFiring: 0
|
|
||||||
lookSpeed: 50
|
|
||||||
--- !u!114 &5170482295850327424
|
--- !u!114 &5170482295850327424
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -1559,10 +1544,10 @@ MonoBehaviour:
|
|||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
raycast: {fileID: 9178730298827149128}
|
raycast: {fileID: 9178730298827149128}
|
||||||
firePoint: {fileID: 6083229256174510991}
|
firePoint: {fileID: 6083229256174510991}
|
||||||
_projectilePrefab: {fileID: 1990380580032880, guid: 46b312e00ed9c1f459ea9f0e55bfac77,
|
projectilePrefab: {fileID: 1990380580032880, guid: 46b312e00ed9c1f459ea9f0e55bfac77,
|
||||||
type: 3}
|
type: 3}
|
||||||
gun: {fileID: 6083229256174510991}
|
gun: {fileID: 6083229256174510991}
|
||||||
--- !u!114 &5519976521156458274
|
--- !u!114 &8568640505362233545
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
@ -1571,55 +1556,29 @@ MonoBehaviour:
|
|||||||
m_GameObject: {fileID: 2528273238195332181}
|
m_GameObject: {fileID: 2528273238195332181}
|
||||||
m_Enabled: 1
|
m_Enabled: 1
|
||||||
m_EditorHideFlags: 0
|
m_EditorHideFlags: 0
|
||||||
m_Script: {fileID: 11500000, guid: e63e19e155f6b6348897150b67863072, type: 3}
|
m_Script: {fileID: 11500000, guid: 3d606407023147d7b4d530a9593e9697, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
moveSpeed: 1
|
targetTransform: {fileID: 2528273238195566709}
|
||||||
shiftAdditionalSpeed: 1
|
cameraTransform: {fileID: 3401070369230030472}
|
||||||
mouseSensitivity: 0
|
lookSpeed: 0.1
|
||||||
invertMouse: 0
|
followSpeed: 0.1
|
||||||
autoLockCursor: 0
|
pivotSpeed: 0.03
|
||||||
cam: {fileID: 5592602041335177245}
|
LookAngle: 0
|
||||||
character: {fileID: 2528273238195332181}
|
minimumPivot: -35
|
||||||
--- !u!23 &-4820536401884566159
|
maximumPivot: 35
|
||||||
MeshRenderer:
|
--- !u!114 &5876264296742387244
|
||||||
|
MonoBehaviour:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
m_PrefabInstance: {fileID: 0}
|
m_PrefabInstance: {fileID: 0}
|
||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 2528273238195332181}
|
m_GameObject: {fileID: 2528273238195332181}
|
||||||
m_Enabled: 1
|
m_Enabled: 1
|
||||||
m_CastShadows: 1
|
m_EditorHideFlags: 0
|
||||||
m_ReceiveShadows: 1
|
m_Script: {fileID: 11500000, guid: a8c9a8e604d395c4ab9d03d28adc4982, type: 3}
|
||||||
m_DynamicOccludee: 1
|
m_Name:
|
||||||
m_MotionVectors: 1
|
m_EditorClassIdentifier:
|
||||||
m_LightProbeUsage: 1
|
|
||||||
m_ReflectionProbeUsage: 1
|
|
||||||
m_RayTracingMode: 2
|
|
||||||
m_RenderingLayerMask: 1
|
|
||||||
m_RendererPriority: 0
|
|
||||||
m_Materials:
|
|
||||||
- {fileID: 0}
|
|
||||||
m_StaticBatchInfo:
|
|
||||||
firstSubMesh: 0
|
|
||||||
subMeshCount: 0
|
|
||||||
m_StaticBatchRoot: {fileID: 0}
|
|
||||||
m_ProbeAnchor: {fileID: 0}
|
|
||||||
m_LightProbeVolumeOverride: {fileID: 0}
|
|
||||||
m_ScaleInLightmap: 1
|
|
||||||
m_ReceiveGI: 1
|
|
||||||
m_PreserveUVs: 0
|
|
||||||
m_IgnoreNormalsForChartDetection: 0
|
|
||||||
m_ImportantGI: 0
|
|
||||||
m_StitchLightmapSeams: 1
|
|
||||||
m_SelectedEditorRenderState: 3
|
|
||||||
m_MinimumChartSize: 4
|
|
||||||
m_AutoUVMaxDistance: 0.5
|
|
||||||
m_AutoUVMaxAngle: 89
|
|
||||||
m_LightmapParameters: {fileID: 0}
|
|
||||||
m_SortingLayerID: 0
|
|
||||||
m_SortingLayer: 0
|
|
||||||
m_SortingOrder: 0
|
|
||||||
--- !u!1 &2528273238195332183
|
--- !u!1 &2528273238195332183
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -3128,8 +3087,8 @@ Transform:
|
|||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 5234455722044222527}
|
m_GameObject: {fileID: 5234455722044222527}
|
||||||
m_LocalRotation: {x: -0.7071068, y: 0, z: 0, w: 0.7071068}
|
m_LocalRotation: {x: -0.7071068, y: 0, z: 0, w: 0.7071068}
|
||||||
m_LocalPosition: {x: 0, y: 0, z: 1}
|
m_LocalPosition: {x: 0, y: -0.642, z: 4.02}
|
||||||
m_LocalScale: {x: 0.01, y: 0.01, z: 0.01}
|
m_LocalScale: {x: 0.03831688, y: 0.03831688, z: 0.03831688}
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 3401070369230030472}
|
m_Father: {fileID: 3401070369230030472}
|
||||||
m_RootOrder: 0
|
m_RootOrder: 0
|
||||||
@ -3141,7 +3100,7 @@ MeshFilter:
|
|||||||
m_PrefabInstance: {fileID: 0}
|
m_PrefabInstance: {fileID: 0}
|
||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 5234455722044222527}
|
m_GameObject: {fileID: 5234455722044222527}
|
||||||
m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0}
|
m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}
|
||||||
--- !u!23 &1446591995090098502
|
--- !u!23 &1446591995090098502
|
||||||
MeshRenderer:
|
MeshRenderer:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -3206,7 +3165,7 @@ Transform:
|
|||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 5585342347362633954}
|
m_GameObject: {fileID: 5585342347362633954}
|
||||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||||
m_LocalPosition: {x: 0.099999994, y: 2.5029998, z: -1.8900003}
|
m_LocalPosition: {x: -0.049, y: 2.5029998, z: -1.8900003}
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_Children:
|
m_Children:
|
||||||
- {fileID: 7744902250868623004}
|
- {fileID: 7744902250868623004}
|
||||||
@ -3476,7 +3435,6 @@ GameObject:
|
|||||||
serializedVersion: 6
|
serializedVersion: 6
|
||||||
m_Component:
|
m_Component:
|
||||||
- component: {fileID: 3808104189668072889}
|
- component: {fileID: 3808104189668072889}
|
||||||
- component: {fileID: 6900876834040779050}
|
|
||||||
m_Layer: 0
|
m_Layer: 0
|
||||||
m_Name: Camera Holder
|
m_Name: Camera Holder
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
@ -3499,26 +3457,6 @@ Transform:
|
|||||||
m_Father: {fileID: 2528273238195566709}
|
m_Father: {fileID: 2528273238195566709}
|
||||||
m_RootOrder: 8
|
m_RootOrder: 8
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
--- !u!114 &6900876834040779050
|
|
||||||
MonoBehaviour:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 7419068246808297193}
|
|
||||||
m_Enabled: 1
|
|
||||||
m_EditorHideFlags: 0
|
|
||||||
m_Script: {fileID: 11500000, guid: 3d606407023147d7b4d530a9593e9697, type: 3}
|
|
||||||
m_Name:
|
|
||||||
m_EditorClassIdentifier:
|
|
||||||
targetTransform: {fileID: 2528273238195566709}
|
|
||||||
cameraTransform: {fileID: 3401070369230030472}
|
|
||||||
cameraPivotTransform: {fileID: 916820916668423615}
|
|
||||||
LookSpeed: 0.1
|
|
||||||
FollowSpeed: 0.1
|
|
||||||
PivotSpeed: 0.03
|
|
||||||
minimumPivot: -35
|
|
||||||
maximumPivot: 35
|
|
||||||
--- !u!1 &8287218850849767936
|
--- !u!1 &8287218850849767936
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -3545,7 +3483,7 @@ Transform:
|
|||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 8287218850849767936}
|
m_GameObject: {fileID: 8287218850849767936}
|
||||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||||
m_LocalPosition: {x: 0.09401773, y: 0.40798557, z: 0.68032074}
|
m_LocalPosition: {x: 0.09401773, y: 2.297, z: -2.12}
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_Children:
|
m_Children:
|
||||||
- {fileID: 77805209700100364}
|
- {fileID: 77805209700100364}
|
||||||
|
@ -1774,7 +1774,7 @@ Mesh:
|
|||||||
m_CorrespondingSourceObject: {fileID: 0}
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
m_PrefabInstance: {fileID: 0}
|
m_PrefabInstance: {fileID: 0}
|
||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_Name: pb_Mesh19226
|
m_Name: pb_Mesh26546
|
||||||
serializedVersion: 10
|
serializedVersion: 10
|
||||||
m_SubMeshes:
|
m_SubMeshes:
|
||||||
- serializedVersion: 2
|
- serializedVersion: 2
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
using Unity.Mathematics;
|
using System;
|
||||||
|
using CameraScripts;
|
||||||
|
using Unity.Mathematics;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace Animators.Leonid_Animator
|
namespace Animators.Leonid_Animator
|
||||||
@ -10,7 +12,7 @@ namespace Animators.Leonid_Animator
|
|||||||
|
|
||||||
private int _horizontal;
|
private int _horizontal;
|
||||||
private int _vertical;
|
private int _vertical;
|
||||||
private bool _isCrouching = false;
|
public bool isCrouching = false;
|
||||||
private bool _isJumping;
|
private bool _isJumping;
|
||||||
|
|
||||||
private int _crouch;
|
private int _crouch;
|
||||||
@ -77,14 +79,8 @@ namespace Animators.Leonid_Animator
|
|||||||
|
|
||||||
if (pressedCrouching == true)
|
if (pressedCrouching == true)
|
||||||
{
|
{
|
||||||
_isCrouching = !_isCrouching;
|
isCrouching = !isCrouching;
|
||||||
if (_isCrouching == true)
|
anim.SetBool(_crouch, isCrouching);
|
||||||
transform.Rotate(Vector3.up, 45);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
transform.Rotate(Vector3.up, -45);
|
|
||||||
}
|
|
||||||
anim.SetBool(_crouch, _isCrouching);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
anim.SetBool(_jump, pressedJumped);
|
anim.SetBool(_jump, pressedJumped);
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using UnityEngine;
|
using System;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
namespace Animators.Leonid_Animator.Player
|
namespace Animators.Leonid_Animator.Player
|
||||||
{
|
{
|
||||||
@ -19,15 +20,19 @@ namespace Animators.Leonid_Animator.Player
|
|||||||
[SerializeField] public float jumpForce;
|
[SerializeField] public float jumpForce;
|
||||||
|
|
||||||
[Header("Stats")]
|
[Header("Stats")]
|
||||||
[SerializeField] private float movementSpeed = 5;
|
[SerializeField] private float movementSpeed = 25;
|
||||||
[SerializeField] private float rotationSpeed = 10;
|
[SerializeField] private float rotationSpeed = 10;
|
||||||
|
|
||||||
private void Start()
|
|
||||||
|
private void Awake()
|
||||||
{
|
{
|
||||||
myRigidbody = GetComponent<Rigidbody>();
|
myRigidbody = GetComponent<Rigidbody>();
|
||||||
_inputHandler = GetComponent<InputHandler>();
|
_inputHandler = GetComponent<InputHandler>();
|
||||||
myAnimatorHandler = GetComponent<AnimatorHandler>();
|
myAnimatorHandler = GetComponent<AnimatorHandler>();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Start()
|
||||||
|
{
|
||||||
_cameraObject = Camera.main.transform;
|
_cameraObject = Camera.main.transform;
|
||||||
myTransform = transform;
|
myTransform = transform;
|
||||||
myAnimatorHandler.Initialize();
|
myAnimatorHandler.Initialize();
|
||||||
@ -70,6 +75,16 @@ namespace Animators.Leonid_Animator.Player
|
|||||||
_inputHandler.crouchPressed = false;
|
_inputHandler.crouchPressed = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Vector3 GetMeshCenter()
|
||||||
|
{
|
||||||
|
if (myAnimatorHandler.isCrouching)
|
||||||
|
return transform.position + 1f * Vector3.up;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return transform.position + 2f * Vector3.up;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#region Movement
|
#region Movement
|
||||||
|
|
||||||
private Vector3 _normalVector;
|
private Vector3 _normalVector;
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using CameraScripts;
|
using System;
|
||||||
|
using CameraScripts;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace Animators.Leonid_Animator.Player
|
namespace Animators.Leonid_Animator.Player
|
||||||
@ -21,7 +22,7 @@ namespace Animators.Leonid_Animator.Player
|
|||||||
|
|
||||||
private CameraHandler _cameraHandler;
|
private CameraHandler _cameraHandler;
|
||||||
|
|
||||||
private void Awake()
|
private void Start()
|
||||||
{
|
{
|
||||||
_cameraHandler = CameraHandler.Singleton;
|
_cameraHandler = CameraHandler.Singleton;
|
||||||
if (_cameraHandler == null)
|
if (_cameraHandler == null)
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
using System.Collections.Generic;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using Unity.Barracuda;
|
using Unity.Barracuda;
|
||||||
using Unity.MLAgents.Policies;
|
using Unity.MLAgents.Policies;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
using Random = UnityEngine.Random;
|
||||||
|
|
||||||
public class CharacterFactory : MonoBehaviour
|
public class CharacterFactory : MonoBehaviour
|
||||||
{
|
{
|
||||||
@ -14,7 +16,7 @@ public class CharacterFactory : MonoBehaviour
|
|||||||
[SerializeField] private GameObject PlayerPrefab;
|
[SerializeField] private GameObject PlayerPrefab;
|
||||||
|
|
||||||
private List<GameObject> bots = new List<GameObject>();
|
private List<GameObject> bots = new List<GameObject>();
|
||||||
public GameObject player { get; private set; }
|
public GameObject Player { get; private set; }
|
||||||
|
|
||||||
private void Awake()
|
private void Awake()
|
||||||
{
|
{
|
||||||
@ -27,6 +29,11 @@ public class CharacterFactory : MonoBehaviour
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void Update()
|
||||||
|
{
|
||||||
|
print(Player == null);
|
||||||
|
}
|
||||||
|
|
||||||
private void Start()
|
private void Start()
|
||||||
{
|
{
|
||||||
var attcNum = SettingsReader.Instance.GetSettings.NumOfAttackers;
|
var attcNum = SettingsReader.Instance.GetSettings.NumOfAttackers;
|
||||||
@ -37,12 +44,6 @@ public class CharacterFactory : MonoBehaviour
|
|||||||
if (humanAtc == 1 && humanDef == 1)
|
if (humanAtc == 1 && humanDef == 1)
|
||||||
throw new System.ArgumentException("Can be only one human player");
|
throw new System.ArgumentException("Can be only one human player");
|
||||||
|
|
||||||
for (int i = 0; i < attcNum - humanAtc; i++)
|
|
||||||
InstantiateEntity(Team.Attackers, TypeAI.D0DiskAI,
|
|
||||||
spawnPointsForAttackersTeam[Random.Range(0, spawnPointsForAttackersTeam.Count)]);
|
|
||||||
for (int i = 0; i < defNum - humanDef; i++)
|
|
||||||
InstantiateEntity(Team.Defenders, TypeAI.D0DiskAI,
|
|
||||||
spawnPointsForDefendersTeam[Random.Range(0, spawnPointsForDefendersTeam.Count)]);
|
|
||||||
if (humanAtc == 1)
|
if (humanAtc == 1)
|
||||||
InstantiateEntity(Team.Attackers, TypeAI.HumanAI,
|
InstantiateEntity(Team.Attackers, TypeAI.HumanAI,
|
||||||
spawnPointsForAttackersTeam[Random.Range(0, spawnPointsForAttackersTeam.Count)]);
|
spawnPointsForAttackersTeam[Random.Range(0, spawnPointsForAttackersTeam.Count)]);
|
||||||
@ -50,6 +51,13 @@ public class CharacterFactory : MonoBehaviour
|
|||||||
InstantiateEntity(Team.Defenders, TypeAI.HumanAI,
|
InstantiateEntity(Team.Defenders, TypeAI.HumanAI,
|
||||||
spawnPointsForDefendersTeam[Random.Range(0, spawnPointsForDefendersTeam.Count)]);
|
spawnPointsForDefendersTeam[Random.Range(0, spawnPointsForDefendersTeam.Count)]);
|
||||||
|
|
||||||
|
for (int i = 0; i < attcNum - humanAtc; i++)
|
||||||
|
InstantiateEntity(Team.Attackers, TypeAI.D0DiskAI,
|
||||||
|
spawnPointsForAttackersTeam[Random.Range(0, spawnPointsForAttackersTeam.Count)]);
|
||||||
|
for (int i = 0; i < defNum - humanDef; i++)
|
||||||
|
InstantiateEntity(Team.Defenders, TypeAI.D0DiskAI,
|
||||||
|
spawnPointsForDefendersTeam[Random.Range(0, spawnPointsForDefendersTeam.Count)]);
|
||||||
|
|
||||||
GameManager.OnResetScene += ResetCharacters;
|
GameManager.OnResetScene += ResetCharacters;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -65,8 +73,9 @@ public class CharacterFactory : MonoBehaviour
|
|||||||
|
|
||||||
if (typeAi == TypeAI.HumanAI)
|
if (typeAi == TypeAI.HumanAI)
|
||||||
{
|
{
|
||||||
|
print("added player to list");
|
||||||
gameobject.GetComponent<Player>().GetCharacter.Team = team;
|
gameobject.GetComponent<Player>().GetCharacter.Team = team;
|
||||||
player = gameobject;
|
Player = gameobject;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -101,18 +110,23 @@ public class CharacterFactory : MonoBehaviour
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ReSpawn(ICharacter character, ref Vector3 pos, ref int startPointId)
|
public void ReSpawn(ICharacter character, GameObject go)
|
||||||
{
|
{
|
||||||
character.ResetCharacter();
|
character.ResetCharacter();
|
||||||
var team = character.GetCharacter.Team;
|
var team = character.GetCharacter.Team;
|
||||||
|
var ai = character.GetCharacter.TypeAi;
|
||||||
NavPoint navPoint;
|
NavPoint navPoint;
|
||||||
if (team == Team.Attackers)
|
if (team == Team.Attackers)
|
||||||
navPoint = spawnPointsForAttackersTeam[Random.Range(0, spawnPointsForAttackersTeam.Count)];
|
navPoint = spawnPointsForAttackersTeam[Random.Range(0, spawnPointsForAttackersTeam.Count)];
|
||||||
else
|
else
|
||||||
navPoint = spawnPointsForDefendersTeam[Random.Range(0, spawnPointsForDefendersTeam.Count)];
|
navPoint = spawnPointsForDefendersTeam[Random.Range(0, spawnPointsForDefendersTeam.Count)];
|
||||||
|
|
||||||
pos = navPoint.Position;
|
go.transform.position = navPoint.Position;
|
||||||
startPointId = navPoint.PointId;
|
if (ai == TypeAI.D0DiskAI)
|
||||||
|
{
|
||||||
|
var mc =go.GetComponent<MovementController>();
|
||||||
|
mc.PointStartID = navPoint.PointId;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ResetCharacters()
|
private void ResetCharacters()
|
||||||
@ -131,9 +145,9 @@ public class CharacterFactory : MonoBehaviour
|
|||||||
{
|
{
|
||||||
player.ResetCharacter();
|
player.ResetCharacter();
|
||||||
if (player.GetCharacter.Team == Team.Attackers)
|
if (player.GetCharacter.Team == Team.Attackers)
|
||||||
this.player.transform.position = spawnPointsForAttackersTeam[Random.Range(0, spawnPointsForAttackersTeam.Count)].Position;
|
this.Player.transform.position = spawnPointsForAttackersTeam[Random.Range(0, spawnPointsForAttackersTeam.Count)].Position;
|
||||||
else
|
else
|
||||||
this.player.transform.position = spawnPointsForDefendersTeam[Random.Range(0, spawnPointsForDefendersTeam.Count)].Position;
|
this.Player.transform.position = spawnPointsForDefendersTeam[Random.Range(0, spawnPointsForDefendersTeam.Count)].Position;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,4 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using Animators.Leonid_Animator;
|
||||||
|
using Animators.Leonid_Animator.Player;
|
||||||
using Unity.Mathematics;
|
using Unity.Mathematics;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
@ -7,50 +9,52 @@ namespace CameraScripts
|
|||||||
public class CameraHandler : MonoBehaviour
|
public class CameraHandler : MonoBehaviour
|
||||||
{
|
{
|
||||||
public Transform targetTransform;
|
public Transform targetTransform;
|
||||||
public Transform cameraTransform;
|
|
||||||
public Transform cameraPivotTransform;
|
|
||||||
private Transform _myTransform;
|
private Transform _myTransform;
|
||||||
private Vector3 _cameraTransformPosition;
|
[SerializeField] private Transform cameraTransform;
|
||||||
private LayerMask ignoreLayers = ~(1 << 8 | 1 << 9 | 1 << 10);
|
|
||||||
|
|
||||||
public static CameraHandler Singleton;
|
public static CameraHandler Singleton;
|
||||||
|
|
||||||
[SerializeField] private float LookSpeed = 0.1f;
|
[SerializeField] private float lookSpeed = 0.1f;
|
||||||
[SerializeField] private float FollowSpeed = 0.1f;
|
[SerializeField] private float followSpeed = 0.1f;
|
||||||
[SerializeField] private float PivotSpeed = 0.03f;
|
[SerializeField] private float pivotSpeed = 0.03f;
|
||||||
|
|
||||||
private float _defaultPosition;
|
public float LookAngle;
|
||||||
private float _lookAngle;
|
|
||||||
private float _pivotAngle;
|
private float _pivotAngle;
|
||||||
|
|
||||||
public float minimumPivot = -35;
|
public float minimumPivot = -35;
|
||||||
public float maximumPivot = 35;
|
public float maximumPivot = 35;
|
||||||
|
|
||||||
|
private AnimatorHandler _animatorHandler;
|
||||||
|
|
||||||
|
|
||||||
private void Awake()
|
private void Awake()
|
||||||
{
|
{
|
||||||
Application.targetFrameRate = 60;
|
|
||||||
Singleton = this;
|
Singleton = this;
|
||||||
_myTransform = transform;
|
_myTransform = transform;
|
||||||
_defaultPosition = _myTransform.localPosition.z;
|
}
|
||||||
|
|
||||||
|
private void Start()
|
||||||
|
{
|
||||||
|
_animatorHandler = gameObject.GetComponent<AnimatorHandler>();
|
||||||
|
if (_animatorHandler == null)
|
||||||
|
print(gameObject.name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void TargetPosition(float delta)
|
public void TargetPosition(float delta)
|
||||||
{
|
{
|
||||||
var toTargetPosition = Vector3.Lerp(_myTransform.position, targetTransform.position, delta /FollowSpeed);
|
var toTargetPosition = Vector3.Lerp(_myTransform.position, targetTransform.position, delta /followSpeed);
|
||||||
_myTransform.position = toTargetPosition;
|
_myTransform.position = toTargetPosition;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void HandleCameraRotation(float delta, float mouseX, float mouseY)
|
public void HandleCameraRotation(float delta, float mouseX, float mouseY)
|
||||||
{
|
{
|
||||||
_lookAngle += (mouseX * LookSpeed) / delta;
|
LookAngle += (mouseX * lookSpeed) / delta;
|
||||||
_pivotAngle -= (mouseY * PivotSpeed) / delta;
|
_pivotAngle -= (mouseY * pivotSpeed) / delta;
|
||||||
_pivotAngle = Mathf.Clamp(_pivotAngle, minimumPivot, maximumPivot);
|
_pivotAngle = Mathf.Clamp(_pivotAngle, minimumPivot, maximumPivot);
|
||||||
|
|
||||||
var rotation = Vector3.zero;
|
var rotation = Vector3.zero;
|
||||||
rotation.y = _lookAngle;
|
rotation.y = LookAngle;
|
||||||
var targetRotation = Quaternion.Euler(rotation);
|
transform.rotation = Quaternion.Euler(rotation);
|
||||||
targetTransform.rotation = targetRotation;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -4,6 +4,7 @@ public class Character
|
|||||||
public Team Team { get; set; }
|
public Team Team { get; set; }
|
||||||
public float LastTimeHit = 0;
|
public float LastTimeHit = 0;
|
||||||
public CharacterCondition Condition;
|
public CharacterCondition Condition;
|
||||||
|
public TypeAI TypeAi;
|
||||||
|
|
||||||
public Character()
|
public Character()
|
||||||
{
|
{
|
||||||
|
@ -204,16 +204,18 @@ public class NPC : Agent, ICharacter
|
|||||||
_condition.GiveHealth(-Mathf.RoundToInt(damage * (1 - _condition.ArmourPoints * 0.5f)));
|
_condition.GiveHealth(-Mathf.RoundToInt(damage * (1 - _condition.ArmourPoints * 0.5f)));
|
||||||
_condition.GiveArmour(-Mathf.RoundToInt(Mathf.Sqrt(damage) * 5));
|
_condition.GiveArmour(-Mathf.RoundToInt(Mathf.Sqrt(damage) * 5));
|
||||||
OnDamageReceived?.Invoke(damage, GetCharacter.Team);
|
OnDamageReceived?.Invoke(damage, GetCharacter.Team);
|
||||||
|
if (_condition.HealthPoints < 1)
|
||||||
|
{
|
||||||
|
Die();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (_condition.HealthPoints < 0)
|
private void Die()
|
||||||
{
|
{
|
||||||
OnDeathEvent?.Invoke(true);
|
OnDeathEvent?.Invoke(true);
|
||||||
MapManager.AddDeathAttributeToPoints(_moveController.PointStartID, _moveController.PointEndID,
|
MapManager.AddDeathAttributeToPoints(_moveController.PointStartID, _moveController.PointEndID,
|
||||||
_moveController.DistanceToGo, _moveController.RemainingDistance);
|
_moveController.DistanceToGo, _moveController.RemainingDistance);
|
||||||
var pos = gameObject.transform.position;
|
CharacterFactory.Instance.ReSpawn(this, gameObject);
|
||||||
var id = _moveController.PointStartID;
|
|
||||||
CharacterFactory.Instance.ReSpawn(this, ref pos, ref id);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ResetCharacter()
|
public void ResetCharacter()
|
||||||
|
@ -27,8 +27,15 @@ public class Player : MonoBehaviour, ICharacter
|
|||||||
Condition.GiveHealth(-Mathf.RoundToInt(damage * (1 - Condition.ArmourPoints * 0.5f)));
|
Condition.GiveHealth(-Mathf.RoundToInt(damage * (1 - Condition.ArmourPoints * 0.5f)));
|
||||||
Condition.GiveArmour(-Mathf.RoundToInt(Mathf.Sqrt(damage) * 5));
|
Condition.GiveArmour(-Mathf.RoundToInt(Mathf.Sqrt(damage) * 5));
|
||||||
|
|
||||||
if (Condition.HealthPoints < 0)
|
if (Condition.HealthPoints < 1)
|
||||||
|
Die();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Die()
|
||||||
|
{
|
||||||
|
print("dead");
|
||||||
OnDeathEvent?.Invoke(true);
|
OnDeathEvent?.Invoke(true);
|
||||||
|
CharacterFactory.Instance.ReSpawn(this, gameObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ResetCharacter()
|
public void ResetCharacter()
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using Animators.Leonid_Animator.Player;
|
||||||
using Unity.MLAgents;
|
using Unity.MLAgents;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
@ -48,7 +49,7 @@ public class GameManager : MonoBehaviour
|
|||||||
if ((SettingsReader.Instance.GetSettings.HasHumanAttacker == true && oppositeTeam == Team.Attackers) ||
|
if ((SettingsReader.Instance.GetSettings.HasHumanAttacker == true && oppositeTeam == Team.Attackers) ||
|
||||||
(SettingsReader.Instance.GetSettings.HasHumanDefender == true && oppositeTeam == Team.Defenders))
|
(SettingsReader.Instance.GetSettings.HasHumanDefender == true && oppositeTeam == Team.Defenders))
|
||||||
{
|
{
|
||||||
if (distToNavPoint > (currentTransform - CharacterFactory.Instance.player.transform.position).magnitude)
|
if (distToNavPoint > (currentTransform - CharacterFactory.Instance.Player.transform.position).magnitude)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@ -64,7 +65,7 @@ public class GameManager : MonoBehaviour
|
|||||||
if ((SettingsReader.Instance.GetSettings.HasHumanAttacker == true && oppositeTeam == Team.Attackers) ||
|
if ((SettingsReader.Instance.GetSettings.HasHumanAttacker == true && oppositeTeam == Team.Attackers) ||
|
||||||
(SettingsReader.Instance.GetSettings.HasHumanDefender == true && oppositeTeam == Team.Defenders))
|
(SettingsReader.Instance.GetSettings.HasHumanDefender == true && oppositeTeam == Team.Defenders))
|
||||||
{
|
{
|
||||||
if ((currentTransform - CharacterFactory.Instance.player.transform.position).magnitude < SettingsReader.Instance.GetSettings.ViewDistance)
|
if ((currentTransform - CharacterFactory.Instance.Player.transform.position).magnitude < SettingsReader.Instance.GetSettings.ViewDistance)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@ -99,9 +100,9 @@ public class GameManager : MonoBehaviour
|
|||||||
if ((SettingsReader.Instance.GetSettings.HasHumanAttacker == true && oppositeTeam == Team.Attackers) ||
|
if ((SettingsReader.Instance.GetSettings.HasHumanAttacker == true && oppositeTeam == Team.Attackers) ||
|
||||||
(SettingsReader.Instance.GetSettings.HasHumanDefender == true && oppositeTeam == Team.Defenders))
|
(SettingsReader.Instance.GetSettings.HasHumanDefender == true && oppositeTeam == Team.Defenders))
|
||||||
{
|
{
|
||||||
var player = CharacterFactory.Instance.player;
|
var player = CharacterFactory.Instance.Player;
|
||||||
if (Physics.Raycast(position,
|
if (Physics.Raycast(position,
|
||||||
(player.GetComponent<MeshRenderer>().bounds.center - position).normalized,
|
(player.GetComponent<CharacterLocomotion>().GetMeshCenter() - position).normalized,
|
||||||
out rayHit,
|
out rayHit,
|
||||||
SettingsReader.Instance.GetSettings.ViewDistance))
|
SettingsReader.Instance.GetSettings.ViewDistance))
|
||||||
{
|
{
|
||||||
|
@ -47,16 +47,15 @@ public class MapManager : MonoBehaviour
|
|||||||
var startNavPoint = _instance.IDToNavPoint[startPoint];
|
var startNavPoint = _instance.IDToNavPoint[startPoint];
|
||||||
var endNavPoint = _instance.IDToNavPoint[endPoint];
|
var endNavPoint = _instance.IDToNavPoint[endPoint];
|
||||||
float coef;
|
float coef;
|
||||||
try
|
if (allDistance != 0)
|
||||||
{
|
{
|
||||||
coef = remainingDistance / allDistance;
|
coef = remainingDistance / allDistance;
|
||||||
}
|
|
||||||
catch (System.ArithmeticException)
|
|
||||||
{
|
|
||||||
Debug.LogError("Path Length is zero");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
startNavPoint.DeathAttr += 1 - coef;
|
startNavPoint.DeathAttr += 1 - coef;
|
||||||
endNavPoint.DeathAttr += coef;
|
endNavPoint.DeathAttr += coef;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
startNavPoint.DeathAttr += 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,9 +30,6 @@ public class FlagZone : MonoBehaviour
|
|||||||
case "Attacker":
|
case "Attacker":
|
||||||
occupAttackers++;
|
occupAttackers++;
|
||||||
break;
|
break;
|
||||||
default:
|
|
||||||
Debug.LogWarning("Entered non-team entity");
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private void OnTriggerExit(Collider other)
|
private void OnTriggerExit(Collider other)
|
||||||
|
@ -11,7 +11,7 @@ public class Shooting : MonoBehaviour
|
|||||||
[SerializeField] private GameObject projectilePrefab;
|
[SerializeField] private GameObject projectilePrefab;
|
||||||
|
|
||||||
private float hSliderValue = 0.1f;
|
private float hSliderValue = 0.1f;
|
||||||
private float _fireCountdown = 1f;
|
private float _fireCountdown = 0.1f;
|
||||||
|
|
||||||
public GameObject gun;
|
public GameObject gun;
|
||||||
private void Update()
|
private void Update()
|
||||||
@ -25,18 +25,32 @@ public class Shooting : MonoBehaviour
|
|||||||
{
|
{
|
||||||
_fireCountdown = 0;
|
_fireCountdown = 0;
|
||||||
_fireCountdown += hSliderValue;
|
_fireCountdown += hSliderValue;
|
||||||
Shoot();
|
PlayerShoot();
|
||||||
}
|
}
|
||||||
_fireCountdown -= Time.deltaTime;
|
_fireCountdown -= Time.deltaTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void PlayerShoot()
|
||||||
|
{
|
||||||
|
Instantiate(projectilePrefab, firePoint.transform.position, firePoint.transform.rotation);
|
||||||
|
if (Physics.Raycast(raycast.transform.position,
|
||||||
|
raycast.transform.forward, out var hit,
|
||||||
|
SettingsReader.Instance.GetSettings.ViewDistance))
|
||||||
|
{
|
||||||
|
if (hit.transform.TryGetComponent<NPC>(out var target))
|
||||||
|
{
|
||||||
|
target.GetDamage(SettingsReader.Instance.GetSettings.RifleDamage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void Shoot()
|
public void Shoot()
|
||||||
{
|
{
|
||||||
if (Physics.Raycast(raycast.transform.position,
|
if (Physics.Raycast(raycast.transform.position,
|
||||||
raycast.transform.forward, out var hit,
|
raycast.transform.forward, out var hit,
|
||||||
SettingsReader.Instance.GetSettings.ViewDistance))
|
SettingsReader.Instance.GetSettings.ViewDistance))
|
||||||
{
|
{
|
||||||
if (hit.transform.TryGetComponent<NPC>(out var target))
|
if (hit.transform.TryGetComponent<ICharacter>(out var target))
|
||||||
{
|
{
|
||||||
Instantiate(projectilePrefab, firePoint.transform.position, firePoint.transform.rotation);
|
Instantiate(projectilePrefab, firePoint.transform.position, firePoint.transform.rotation);
|
||||||
target.GetDamage(SettingsReader.Instance.GetSettings.RifleDamage);
|
target.GetDamage(SettingsReader.Instance.GetSettings.RifleDamage);
|
||||||
|
8
Assets/Settings/Game Settings.asset
generated
8
Assets/Settings/Game Settings.asset
generated
@ -19,9 +19,9 @@ MonoBehaviour:
|
|||||||
MovementSpeed: 1
|
MovementSpeed: 1
|
||||||
DefTeamAI: 3
|
DefTeamAI: 3
|
||||||
AtcTeamAI: 3
|
AtcTeamAI: 3
|
||||||
NumOfDefenders: 2
|
NumOfDefenders: 1
|
||||||
NumOfAttackers: 2
|
NumOfAttackers: 1
|
||||||
HasHumanDefender: 0
|
HasHumanDefender: 1
|
||||||
HasHumanAttacker: 0
|
HasHumanAttacker: 0
|
||||||
HealthPickupAmount: 50
|
HealthPickupAmount: 50
|
||||||
ArmourPickupAmount: 50
|
ArmourPickupAmount: 50
|
||||||
@ -37,7 +37,7 @@ MonoBehaviour:
|
|||||||
DoDamageChanceInDirectPoint: 70
|
DoDamageChanceInDirectPoint: 70
|
||||||
DoDamageChanceInRunning: 30
|
DoDamageChanceInRunning: 30
|
||||||
DoDamageChanceInCover: 25
|
DoDamageChanceInCover: 25
|
||||||
RifleDamage: 0
|
RifleDamage: 100
|
||||||
RateOfFire: 1
|
RateOfFire: 1
|
||||||
CrouchingCoefficient: 1.4
|
CrouchingCoefficient: 1.4
|
||||||
atcMaterial: {fileID: 2100000, guid: ce639cf318364cf449d4fd87a69da579, type: 2}
|
atcMaterial: {fileID: 2100000, guid: ce639cf318364cf449d4fd87a69da579, type: 2}
|
||||||
|
Reference in New Issue
Block a user