Merge branch 'krazerleo/core/1' into lisin/character/1
This commit is contained in:
6
.vsconfig
Normal file
6
.vsconfig
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"version": "1.0",
|
||||
"components": [
|
||||
"Microsoft.VisualStudio.Workload.ManagedGame"
|
||||
]
|
||||
}
|
@ -1 +1 @@
|
||||
{"count":1,"self":19.9775968,"total":20.018629999999998,"children":{"InitializeActuators":{"count":1,"self":0.0010006,"total":0.0010006,"children":null},"AgentSendState":{"count":765,"self":0.0057472999999999995,"total":0.0057472999999999995,"children":null},"DecideAction":{"count":765,"self":0.0332866,"total":0.0332866,"children":null}},"gauges":{},"metadata":{"timer_format_version":"0.1.0","start_time_seconds":"1649742457","unity_version":"2019.4.35f1","command_line_arguments":"D:\\Unity\\2019.4.35f1\\Editor\\Unity.exe -projectpath C:\\Users\\kiril\\real-shooter -useHub -hubIPC -cloudEnvironment production -licensingIpc LicenseClient-kiril -hubSessionId 21e9de90-ba14-11ec-9398-079edccf5e34 -accessToken oIpf_7gKWQQRilVTeJehUsFhrxasdzsG_K3j5Swtgx0009f","communication_protocol_version":"1.5.0","com.unity.ml-agents_version":"2.0.1","scene_name":"Greatest_map_ever","end_time_seconds":"1649742477"}}
|
||||
{"count":1,"self":16.677081599999998,"total":16.6850819,"children":{"InitializeActuators":{"count":1,"self":0.0020011,"total":0.0020011,"children":null},"InitializeSensors":{"count":1,"self":0.0019998,"total":0.0019998,"children":null},"AgentSendState":{"count":1,"self":0.0020001,"total":0.0030001,"children":{"CollectObservations":{"count":1,"self":0.001,"total":0.001,"children":null}}}},"gauges":{},"metadata":{"timer_format_version":"0.1.0","start_time_seconds":"1650121997","unity_version":"2019.4.35f1","command_line_arguments":"C:\\Program Files\\unityeditorfolder\\2019.4.35f1\\Editor\\Unity.exe -projectpath F:\\SigmaRiskManagment\\real shooter Git Version -useHub -hubIPC -cloudEnvironment production -licensingIpc LicenseClient-BipJTP5Uk-fN-2Lss2TUJ -hubSessionId a1fe6f50-bcbd-11ec-b648-df8ff5c97a4c -accessToken K_G64_ace_5LgpX3riGrgGS92ESag4RH04Ti1lswMX8009f","communication_protocol_version":"1.5.0","com.unity.ml-agents_version":"2.0.1","scene_name":"Greatest_map_ever","end_time_seconds":"1650122013"}}
|
92
Assets/Prefabs/Bot.prefab
generated
92
Assets/Prefabs/Bot.prefab
generated
@ -13,6 +13,10 @@ GameObject:
|
||||
- component: {fileID: 2988578997639256868}
|
||||
- component: {fileID: 2988578997639256875}
|
||||
- component: {fileID: 5447337162552783061}
|
||||
- component: {fileID: 7805954453358028498}
|
||||
- component: {fileID: 2676446634235362783}
|
||||
- component: {fileID: 8656710265340117963}
|
||||
- component: {fileID: 778652956973742106}
|
||||
m_Layer: 0
|
||||
m_Name: Bot
|
||||
m_TagString: Untagged
|
||||
@ -107,7 +111,87 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: a6f2a081cfc8c4b4bb6864331109d147, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
HealthPoints: 100
|
||||
Armour: 100
|
||||
Ammunition: 360
|
||||
LastTimeHit: 0
|
||||
agentParameters:
|
||||
maxStep: 0
|
||||
hasUpgradedFromAgentParameters: 1
|
||||
MaxStep: 100
|
||||
moveController: {fileID: 778652956973742106}
|
||||
--- !u!114 &7805954453358028498
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2988578997639256874}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 3a5c9d521e5ef4759a8246a07d52221e, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
DecisionPeriod: 1
|
||||
TakeActionsBetweenDecisions: 1
|
||||
--- !u!114 &2676446634235362783
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2988578997639256874}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 5d1c4e0b1822b495aa52bc52839ecb30, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_BrainParameters:
|
||||
VectorObservationSize: 1
|
||||
NumStackedVectorObservations: 1
|
||||
m_ActionSpec:
|
||||
m_NumContinuousActions: 0
|
||||
BranchSizes: 01000000
|
||||
VectorActionSize: 01000000
|
||||
VectorActionDescriptions: []
|
||||
VectorActionSpaceType: 0
|
||||
hasUpgradedBrainParametersWithActionSpec: 1
|
||||
m_Model: {fileID: 0}
|
||||
m_InferenceDevice: 0
|
||||
m_BehaviorType: 0
|
||||
m_BehaviorName: My Behavior
|
||||
TeamId: 0
|
||||
m_UseChildSensors: 1
|
||||
m_UseChildActuators: 1
|
||||
m_ObservableAttributeHandling: 0
|
||||
--- !u!195 &8656710265340117963
|
||||
NavMeshAgent:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2988578997639256874}
|
||||
m_Enabled: 1
|
||||
m_AgentTypeID: 0
|
||||
m_Radius: 0.5
|
||||
m_Speed: 3.5
|
||||
m_Acceleration: 8
|
||||
avoidancePriority: 50
|
||||
m_AngularSpeed: 120
|
||||
m_StoppingDistance: 0
|
||||
m_AutoTraverseOffMeshLink: 1
|
||||
m_AutoBraking: 1
|
||||
m_AutoRepath: 1
|
||||
m_Height: 2
|
||||
m_BaseOffset: 1
|
||||
m_WalkableMask: 4294967295
|
||||
m_ObstacleAvoidanceType: 4
|
||||
--- !u!114 &778652956973742106
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2988578997639256874}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: d3ebcf807a37f344998fd648dfc9376d, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
navMeshAgent: {fileID: 8656710265340117963}
|
||||
|
425
Assets/Prefabs/Player.prefab
generated
425
Assets/Prefabs/Player.prefab
generated
@ -1,6 +1,6 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &4528203470433968325
|
||||
--- !u!1 &5245491127989480125
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
@ -8,98 +8,15 @@ GameObject:
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 4528203470433968376}
|
||||
- component: {fileID: 4528203470433968327}
|
||||
- component: {fileID: 4528203470433968326}
|
||||
m_Layer: 8
|
||||
m_Name: Camera
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &4528203470433968376
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4528203470433968325}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0.734, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 4528203471293941515}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!20 &4528203470433968327
|
||||
Camera:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4528203470433968325}
|
||||
m_Enabled: 1
|
||||
serializedVersion: 2
|
||||
m_ClearFlags: 1
|
||||
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
|
||||
m_projectionMatrixMode: 1
|
||||
m_GateFitMode: 2
|
||||
m_FOVAxisMode: 0
|
||||
m_SensorSize: {x: 36, y: 24}
|
||||
m_LensShift: {x: 0, y: 0}
|
||||
m_FocalLength: 50
|
||||
m_NormalizedViewPortRect:
|
||||
serializedVersion: 2
|
||||
x: 0
|
||||
y: 0
|
||||
width: 1
|
||||
height: 1
|
||||
near clip plane: 0.3
|
||||
far clip plane: 1000
|
||||
field of view: 60
|
||||
orthographic: 0
|
||||
orthographic size: 5
|
||||
m_Depth: 0
|
||||
m_CullingMask:
|
||||
serializedVersion: 2
|
||||
m_Bits: 4294967295
|
||||
m_RenderingPath: -1
|
||||
m_TargetTexture: {fileID: 0}
|
||||
m_TargetDisplay: 0
|
||||
m_TargetEye: 3
|
||||
m_HDR: 1
|
||||
m_AllowMSAA: 1
|
||||
m_AllowDynamicResolution: 0
|
||||
m_ForceIntoRT: 0
|
||||
m_OcclusionCulling: 1
|
||||
m_StereoConvergence: 10
|
||||
m_StereoSeparation: 0.022
|
||||
--- !u!81 &4528203470433968326
|
||||
AudioListener:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4528203470433968325}
|
||||
m_Enabled: 1
|
||||
--- !u!1 &4528203470625763699
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 4528203470625763689}
|
||||
- component: {fileID: 4528203470625763688}
|
||||
- component: {fileID: -4942972567661207728}
|
||||
- component: {fileID: 4528203470625763702}
|
||||
- component: {fileID: 4528203470625763690}
|
||||
- component: {fileID: 4528203470625763703}
|
||||
- component: {fileID: 4528203470625763701}
|
||||
- component: {fileID: 4528203470625763700}
|
||||
- component: {fileID: 1061105263471521090}
|
||||
- component: {fileID: 5245491127989480103}
|
||||
- component: {fileID: 5245491127989480102}
|
||||
- component: {fileID: 5583297852527723678}
|
||||
- component: {fileID: 5245491127989480120}
|
||||
- component: {fileID: 5245491127989480100}
|
||||
- component: {fileID: 5245491127989480121}
|
||||
- component: {fileID: 5245491127989480123}
|
||||
- component: {fileID: 5245491127989480122}
|
||||
- component: {fileID: 4890899368932544690}
|
||||
m_Layer: 8
|
||||
m_Name: Player
|
||||
m_TagString: Defender
|
||||
@ -107,37 +24,37 @@ GameObject:
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &4528203470625763689
|
||||
--- !u!4 &5245491127989480103
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4528203470625763699}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 28.21, y: 14.12, z: 48.395}
|
||||
m_GameObject: {fileID: 5245491127989480125}
|
||||
m_LocalRotation: {x: 0, y: 0.7071068, z: 0, w: 0.7071068}
|
||||
m_LocalPosition: {x: 28.21, y: 10.9, z: 46.67}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children:
|
||||
- {fileID: 4528203471293941515}
|
||||
- {fileID: 4528203471164033737}
|
||||
- {fileID: 5245491129196666053}
|
||||
- {fileID: 5245491129603592455}
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!33 &4528203470625763688
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 90, z: 0}
|
||||
--- !u!33 &5245491127989480102
|
||||
MeshFilter:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4528203470625763699}
|
||||
m_GameObject: {fileID: 5245491127989480125}
|
||||
m_Mesh: {fileID: 10208, guid: 0000000000000000e000000000000000, type: 0}
|
||||
--- !u!23 &-4942972567661207728
|
||||
--- !u!23 &5583297852527723678
|
||||
MeshRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4528203470625763699}
|
||||
m_GameObject: {fileID: 5245491127989480125}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 1
|
||||
m_ReceiveShadows: 1
|
||||
@ -170,13 +87,13 @@ MeshRenderer:
|
||||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 0
|
||||
--- !u!136 &4528203470625763702
|
||||
--- !u!136 &5245491127989480120
|
||||
CapsuleCollider:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4528203470625763699}
|
||||
m_GameObject: {fileID: 5245491127989480125}
|
||||
m_Material: {fileID: 0}
|
||||
m_IsTrigger: 0
|
||||
m_Enabled: 0
|
||||
@ -184,13 +101,13 @@ CapsuleCollider:
|
||||
m_Height: 2
|
||||
m_Direction: 1
|
||||
m_Center: {x: 0, y: 0, z: 0}
|
||||
--- !u!136 &4528203470625763690
|
||||
--- !u!136 &5245491127989480100
|
||||
CapsuleCollider:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4528203470625763699}
|
||||
m_GameObject: {fileID: 5245491127989480125}
|
||||
m_Material: {fileID: 0}
|
||||
m_IsTrigger: 0
|
||||
m_Enabled: 0
|
||||
@ -198,13 +115,13 @@ CapsuleCollider:
|
||||
m_Height: 1.3
|
||||
m_Direction: 1
|
||||
m_Center: {x: 0, y: -0.35, z: 0}
|
||||
--- !u!136 &4528203470625763703
|
||||
--- !u!136 &5245491127989480121
|
||||
CapsuleCollider:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4528203470625763699}
|
||||
m_GameObject: {fileID: 5245491127989480125}
|
||||
m_Material: {fileID: 0}
|
||||
m_IsTrigger: 0
|
||||
m_Enabled: 1
|
||||
@ -212,13 +129,13 @@ CapsuleCollider:
|
||||
m_Height: 0.8
|
||||
m_Direction: 1
|
||||
m_Center: {x: 0, y: -0.6, z: 0}
|
||||
--- !u!143 &4528203470625763701
|
||||
--- !u!143 &5245491127989480123
|
||||
CharacterController:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4528203470625763699}
|
||||
m_GameObject: {fileID: 5245491127989480125}
|
||||
m_Material: {fileID: 0}
|
||||
m_IsTrigger: 0
|
||||
m_Enabled: 1
|
||||
@ -230,20 +147,21 @@ CharacterController:
|
||||
m_SkinWidth: 0.08
|
||||
m_MinMoveDistance: 0.001
|
||||
m_Center: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &4528203470625763700
|
||||
--- !u!114 &5245491127989480122
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4528203470625763699}
|
||||
m_GameObject: {fileID: 5245491127989480125}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 9826297ef4d853741b2af768441ec7f7, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
cameraHolder: {fileID: 4528203471293941515}
|
||||
feetTransform: {fileID: 4528203471164033737}
|
||||
input_View: {x: 0, y: 0}
|
||||
cameraHolder: {fileID: 5245491129196666053}
|
||||
feetTransform: {fileID: 5245491129603592455}
|
||||
playerSettings:
|
||||
ViewXSensetivity: 20
|
||||
ViewYSensetivity: 20
|
||||
@ -271,31 +189,31 @@ MonoBehaviour:
|
||||
gravityAmount: 0.05
|
||||
gravityMin: -3
|
||||
jumpingForce: {x: 0, y: 0, z: 0}
|
||||
playerStance: 2
|
||||
playerStance: 0
|
||||
playerStanceSmoothing: 0.2
|
||||
playerStandStance:
|
||||
CameraHeight: 0.7
|
||||
StanceCollider: {fileID: 4528203470625763702}
|
||||
StanceCollider: {fileID: 5245491127989480120}
|
||||
playerCrouchStance:
|
||||
CameraHeight: 0
|
||||
StanceCollider: {fileID: 4528203470625763690}
|
||||
CameraHeight: 0.3
|
||||
StanceCollider: {fileID: 5245491127989480100}
|
||||
playerProneStance:
|
||||
CameraHeight: -0.58
|
||||
StanceCollider: {fileID: 4528203470625763703}
|
||||
--- !u!114 &1061105263471521090
|
||||
StanceCollider: {fileID: 5245491127989480121}
|
||||
currentWeapon: {fileID: 8510909888689775086}
|
||||
--- !u!114 &4890899368932544690
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4528203470625763699}
|
||||
m_GameObject: {fileID: 5245491127989480125}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: a6f2a081cfc8c4b4bb6864331109d147, type: 3}
|
||||
m_Script: {fileID: 11500000, guid: a8c9a8e604d395c4ab9d03d28adc4982, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
LastTimeHit: 0
|
||||
--- !u!1 &4528203471164033736
|
||||
--- !u!1 &5245491128202443531
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
@ -303,29 +221,82 @@ GameObject:
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 4528203471164033737}
|
||||
- component: {fileID: 5245491128202443574}
|
||||
- component: {fileID: 5245491128202443529}
|
||||
- component: {fileID: 5245491128202443528}
|
||||
m_Layer: 8
|
||||
m_Name: FeetTransform
|
||||
m_Name: Camera
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &4528203471164033737
|
||||
--- !u!4 &5245491128202443574
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4528203471164033736}
|
||||
m_GameObject: {fileID: 5245491128202443531}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: -1, z: 0}
|
||||
m_LocalPosition: {x: 0, y: 0.388, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 4528203470625763689}
|
||||
m_RootOrder: 1
|
||||
m_Father: {fileID: 5245491129196666053}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &4528203471293941514
|
||||
--- !u!20 &5245491128202443529
|
||||
Camera:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 5245491128202443531}
|
||||
m_Enabled: 1
|
||||
serializedVersion: 2
|
||||
m_ClearFlags: 1
|
||||
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
|
||||
m_projectionMatrixMode: 1
|
||||
m_GateFitMode: 2
|
||||
m_FOVAxisMode: 0
|
||||
m_SensorSize: {x: 36, y: 24}
|
||||
m_LensShift: {x: 0, y: 0}
|
||||
m_FocalLength: 50
|
||||
m_NormalizedViewPortRect:
|
||||
serializedVersion: 2
|
||||
x: 0
|
||||
y: 0
|
||||
width: 1
|
||||
height: 1
|
||||
near clip plane: 0.1
|
||||
far clip plane: 1000
|
||||
field of view: 60
|
||||
orthographic: 0
|
||||
orthographic size: 5
|
||||
m_Depth: 0
|
||||
m_CullingMask:
|
||||
serializedVersion: 2
|
||||
m_Bits: 4294967295
|
||||
m_RenderingPath: -1
|
||||
m_TargetTexture: {fileID: 0}
|
||||
m_TargetDisplay: 0
|
||||
m_TargetEye: 3
|
||||
m_HDR: 1
|
||||
m_AllowMSAA: 1
|
||||
m_AllowDynamicResolution: 0
|
||||
m_ForceIntoRT: 0
|
||||
m_OcclusionCulling: 1
|
||||
m_StereoConvergence: 10
|
||||
m_StereoSeparation: 0.022
|
||||
--- !u!81 &5245491128202443528
|
||||
AudioListener:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 5245491128202443531}
|
||||
m_Enabled: 1
|
||||
--- !u!1 &5245491129196666052
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
@ -333,7 +304,7 @@ GameObject:
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 4528203471293941515}
|
||||
- component: {fileID: 5245491129196666053}
|
||||
m_Layer: 8
|
||||
m_Name: CameraHolder
|
||||
m_TagString: Untagged
|
||||
@ -341,18 +312,194 @@ GameObject:
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &4528203471293941515
|
||||
--- !u!4 &5245491129196666053
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4528203471293941514}
|
||||
m_GameObject: {fileID: 5245491129196666052}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0.7, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children:
|
||||
- {fileID: 4528203470433968376}
|
||||
m_Father: {fileID: 4528203470625763689}
|
||||
- {fileID: 5245491128202443574}
|
||||
- {fileID: 8510909888689775087}
|
||||
m_Father: {fileID: 5245491127989480103}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &5245491129603592454
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 5245491129603592455}
|
||||
m_Layer: 8
|
||||
m_Name: FeetTransform
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &5245491129603592455
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 5245491129603592454}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: -1, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 5245491127989480103}
|
||||
m_RootOrder: 1
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &8510909888198732725
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 8510909888198732726}
|
||||
- component: {fileID: 8510909888198732713}
|
||||
- component: {fileID: 8510909888198732712}
|
||||
- component: {fileID: 8510909888198732727}
|
||||
m_Layer: 8
|
||||
m_Name: WeaponModel
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &8510909888198732726
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 8510909888198732725}
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 8510909888689775087}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!33 &8510909888198732713
|
||||
MeshFilter:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 8510909888198732725}
|
||||
m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}
|
||||
--- !u!23 &8510909888198732712
|
||||
MeshRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 8510909888198732725}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 1
|
||||
m_ReceiveShadows: 1
|
||||
m_DynamicOccludee: 1
|
||||
m_MotionVectors: 1
|
||||
m_LightProbeUsage: 1
|
||||
m_ReflectionProbeUsage: 1
|
||||
m_RayTracingMode: 2
|
||||
m_RenderingLayerMask: 1
|
||||
m_RendererPriority: 0
|
||||
m_Materials:
|
||||
- {fileID: 10303, guid: 0000000000000000f000000000000000, type: 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!65 &8510909888198732727
|
||||
BoxCollider:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 8510909888198732725}
|
||||
m_Material: {fileID: 0}
|
||||
m_IsTrigger: 0
|
||||
m_Enabled: 1
|
||||
serializedVersion: 2
|
||||
m_Size: {x: 1, y: 1, z: 1}
|
||||
m_Center: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &8510909888689775085
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 8510909888689775087}
|
||||
- component: {fileID: 8510909888689775086}
|
||||
m_Layer: 8
|
||||
m_Name: Weapon
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &8510909888689775087
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 8510909888689775085}
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 0.332, y: 0.038, z: 0.394}
|
||||
m_LocalScale: {x: 0.16226998, y: 0.1581135, z: 1}
|
||||
m_Children:
|
||||
- {fileID: 8510909888198732726}
|
||||
m_Father: {fileID: 5245491129196666053}
|
||||
m_RootOrder: 1
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &8510909888689775086
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 8510909888689775085}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 088bf904d7c90a44dbb35c1d47c2692e, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
settings:
|
||||
SwayAmount: 4
|
||||
SwayYInverted: 0
|
||||
SwayXInverted: 0
|
||||
SwaySmoothing: 0.1
|
||||
SwayResetSmoothing: 0.1
|
||||
SwayClampX: 8
|
||||
SwayClampY: 8
|
||||
|
1295
Assets/Scenes/Greatest_map_ever/Greatest_map_ever.unity
generated
1295
Assets/Scenes/Greatest_map_ever/Greatest_map_ever.unity
generated
File diff suppressed because it is too large
Load Diff
BIN
Assets/Scenes/Greatest_map_ever/NavMesh.asset
generated
BIN
Assets/Scenes/Greatest_map_ever/NavMesh.asset
generated
Binary file not shown.
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 09beff657ef5d1c4eba194a01e121c1a
|
||||
guid: 305bb221606d7a748acca94156e2d347
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 23800000
|
||||
|
0
Assets/Scenes/tyt player.meta
generated
Executable file → Normal file
0
Assets/Scenes/tyt player.meta
generated
Executable file → Normal file
0
Assets/Scenes/tyt player/Player.prefab.meta
generated
Executable file → Normal file
0
Assets/Scenes/tyt player/Player.prefab.meta
generated
Executable file → Normal file
8
Assets/Scripts/Bots/Behaviours.meta
generated
8
Assets/Scripts/Bots/Behaviours.meta
generated
@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9fbac871417fccb40831b0f935247a29
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,17 +0,0 @@
|
||||
using Unity;
|
||||
using UnityEngine;
|
||||
public abstract class BaseBehaviour
|
||||
{
|
||||
protected NPC thisNPC;
|
||||
protected IDoActivity DoActivity;
|
||||
|
||||
protected BaseBehaviour(NPC npc)
|
||||
{
|
||||
thisNPC = npc;
|
||||
}
|
||||
|
||||
public void DoAction()
|
||||
{
|
||||
DoActivity?.DoActivity();
|
||||
}
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 362d340e6754883459f3dc89c9ddc476
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,8 +0,0 @@
|
||||
public class DumbAttacker : BaseBehaviour
|
||||
{
|
||||
public DumbAttacker(NPC npc) : base(npc)
|
||||
{
|
||||
DoActivity = new DumbAttackerBehaviour();
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +0,0 @@
|
||||
public class DumbDefender : BaseBehaviour
|
||||
{
|
||||
public DumbDefender(NPC npc) : base(npc)
|
||||
{
|
||||
DoActivity = new DumbDefenderBehaviour();
|
||||
}
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
public class Human : BaseBehaviour
|
||||
{
|
||||
public Human(NPC npc) : base(npc)
|
||||
{
|
||||
DoActivity = new HumanBehaviour();
|
||||
}
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 59d3d253756147e469e418971625a04c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 93364cc95c8c9764e83d70fcce9da482
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,9 +0,0 @@
|
||||
using UnityEngine;
|
||||
class DumbAttackerBehaviour : IDoActivity
|
||||
{
|
||||
public void DoActivity()
|
||||
{
|
||||
Debug.Log("I do attackers things!");
|
||||
}
|
||||
}
|
||||
|
@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d2cc7b0640887454e96d42f6bd066750
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,9 +0,0 @@
|
||||
using UnityEngine;
|
||||
|
||||
class DumbDefenderBehaviour : IDoActivity
|
||||
{
|
||||
public void DoActivity()
|
||||
{
|
||||
Debug.Log("I do defenders things!");
|
||||
}
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 27106553be3f26b4da5220e39a3098c3
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,8 +0,0 @@
|
||||
class HumanBehaviour : IDoActivity
|
||||
{
|
||||
public void DoActivity()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d207d14aaf634504e84f3e3bd8b52428
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,4 +0,0 @@
|
||||
public interface IDoActivity
|
||||
{
|
||||
void DoActivity();
|
||||
}
|
11
Assets/Scripts/Bots/Behaviours/IDoActivity.cs.meta
generated
11
Assets/Scripts/Bots/Behaviours/IDoActivity.cs.meta
generated
@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8e7275817852aa941963daa476581224
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
59
Assets/Scripts/Bots/CharacterFactory.cs
Normal file
59
Assets/Scripts/Bots/CharacterFactory.cs
Normal file
@ -0,0 +1,59 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using Unity;
|
||||
|
||||
public class CharacterFactory : MonoBehaviour
|
||||
{
|
||||
private CharacterFactory instance;
|
||||
public CharacterFactory Instance { get { return instance; } }
|
||||
|
||||
[SerializeField] private List<NavPoint> spawnPointsForDefendersTeam;
|
||||
[SerializeField] private List<NavPoint> spawnPointsForAttackersTeam;
|
||||
[SerializeField] private GameObject AIPrefab;
|
||||
[SerializeField] private GameObject PlayerPrefab;
|
||||
|
||||
private List<GameObject> Players;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
if (instance == null)
|
||||
instance = this;
|
||||
else
|
||||
Destroy(gameObject);
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
var attcNum = SettingsReader.Instance.GetSettings.numOfAttackers;
|
||||
var defNum = SettingsReader.Instance.GetSettings.numOfDefenders;
|
||||
var humanDef = SettingsReader.Instance.GetSettings.hasHumanDefender == true ? 1 : 0;
|
||||
var humanAtc = SettingsReader.Instance.GetSettings.hasHumanAttacker == true ? 1 : 0;
|
||||
|
||||
if (humanAtc == 1 && humanDef == 1)
|
||||
throw new System.ArgumentException("Can be only one human player");
|
||||
|
||||
for (int i = 0; i < attcNum - humanAtc; i++)
|
||||
InstanciateEntity(Team.Attackers, TypeAI.D0DiskAI,
|
||||
spawnPointsForAttackersTeam[Random.Range(0, spawnPointsForAttackersTeam.Count)]);
|
||||
for (int i = 0; i < defNum - humanDef; i++)
|
||||
InstanciateEntity(Team.Defenders, TypeAI.D0DiskAI,
|
||||
spawnPointsForDefendersTeam[Random.Range(0, spawnPointsForDefendersTeam.Count)]);
|
||||
if (humanAtc == 1)
|
||||
InstanciateEntity(Team.Attackers, TypeAI.HumanAI,
|
||||
spawnPointsForAttackersTeam[Random.Range(0, spawnPointsForAttackersTeam.Count)]);
|
||||
if (humanDef == 1)
|
||||
InstanciateEntity(Team.Defenders, TypeAI.HumanAI,
|
||||
spawnPointsForDefendersTeam[Random.Range(0, spawnPointsForDefendersTeam.Count)]);
|
||||
}
|
||||
|
||||
private void InstanciateEntity(Team team, TypeAI typeAi, NavPoint spawnPoint)
|
||||
{
|
||||
var gameobject = GameObject.Instantiate(
|
||||
typeAi == TypeAI.HumanAI ? PlayerPrefab : AIPrefab,
|
||||
spawnPoint.position,
|
||||
Quaternion.identity);
|
||||
|
||||
var character = gameObject.GetComponent<ICharacter>();
|
||||
character.GetCharacter.Team = team;
|
||||
}
|
||||
}
|
0
Assets/Scripts/Bots/CharacterPooler.cs.meta → Assets/Scripts/Bots/CharacterFactory.cs.meta
generated
Executable file → Normal file
0
Assets/Scripts/Bots/CharacterPooler.cs.meta → Assets/Scripts/Bots/CharacterFactory.cs.meta
generated
Executable file → Normal file
8
Assets/Scripts/Bots/CharacterFactory.meta
generated
8
Assets/Scripts/Bots/CharacterFactory.meta
generated
@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 93133f9c3db1b944d9120ea789988f9b
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,45 +0,0 @@
|
||||
public abstract class AbstractCharacterFactory
|
||||
{
|
||||
protected IDoActivity behaviour;
|
||||
protected AbstractCharacterFactory() { }
|
||||
public abstract BaseBehaviour CreateCharacterBehaviour(NPC npc);
|
||||
}
|
||||
|
||||
public class DumbDefenderFactory : AbstractCharacterFactory
|
||||
{
|
||||
public DumbDefenderFactory()
|
||||
{
|
||||
behaviour = new DumbDefenderBehaviour();
|
||||
}
|
||||
|
||||
public override BaseBehaviour CreateCharacterBehaviour(NPC npc)
|
||||
{
|
||||
return new DumbDefender(npc);
|
||||
}
|
||||
}
|
||||
|
||||
public class DumbAttackerFactory : AbstractCharacterFactory
|
||||
{
|
||||
public DumbAttackerFactory()
|
||||
{
|
||||
behaviour = new DumbAttackerBehaviour();
|
||||
}
|
||||
|
||||
public override BaseBehaviour CreateCharacterBehaviour(NPC npc)
|
||||
{
|
||||
return new DumbAttacker(npc);
|
||||
}
|
||||
}
|
||||
|
||||
public class HumanFactory : AbstractCharacterFactory
|
||||
{
|
||||
public HumanFactory()
|
||||
{
|
||||
behaviour = new HumanBehaviour();
|
||||
}
|
||||
|
||||
public override BaseBehaviour CreateCharacterBehaviour(NPC npc)
|
||||
{
|
||||
return new Human(npc);
|
||||
}
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4f973f98c4f699745a605d09e2c1e46e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,55 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
public class CharacterSpawner : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private GameObject botPrefab;
|
||||
[SerializeField] private List<NavPoint> defendersSpawnPoints;
|
||||
[SerializeField] private List<NavPoint> attackersSpawnPoints;
|
||||
private static Dictionary<(TypeAI, Team), Func<NPC, BaseBehaviour>> behaviourDictionary;
|
||||
private static System.Random random;
|
||||
|
||||
public void Start()
|
||||
{
|
||||
behaviourDictionary = new Dictionary<(TypeAI, Team), Func<NPC, BaseBehaviour>>()
|
||||
{
|
||||
{ (TypeAI.DumbAlgorithm, Team.Attackers), new Func<NPC,BaseBehaviour>( npc => new DumbAttacker(npc))},
|
||||
{ (TypeAI.DumbAlgorithm, Team.Defenders), new Func<NPC,BaseBehaviour>( npc => new DumbDefender(npc)) },
|
||||
{ (TypeAI.HumanAI, Team.Defenders), new Func<NPC,BaseBehaviour>( npc => new Human(npc))},
|
||||
{ (TypeAI.HumanAI, Team.Attackers), new Func<NPC,BaseBehaviour>( npc => new Human(npc))},
|
||||
//And Other behaviours
|
||||
};
|
||||
|
||||
if (SettingsReader.Instance.GetSettings.hasHumanAttacker && SettingsReader.Instance.GetSettings.hasHumanDefender)
|
||||
throw new System.Exception("Not allowed to have two players");
|
||||
else if (SettingsReader.Instance.GetSettings.hasHumanAttacker == true)
|
||||
{
|
||||
spawnCharacter(behaviourDictionary[(TypeAI.HumanAI, Team.Attackers)], Team.Attackers);
|
||||
}
|
||||
else if (SettingsReader.Instance.GetSettings.hasHumanDefender == true)
|
||||
{
|
||||
spawnCharacter(behaviourDictionary[(TypeAI.HumanAI, Team.Defenders)], Team.Defenders);
|
||||
}
|
||||
|
||||
for (int i = 0; i < SettingsReader.Instance.GetSettings.numOfAttackers - (SettingsReader.Instance.GetSettings.hasHumanAttacker ? 1 : 0); i++)
|
||||
{
|
||||
spawnCharacter(behaviourDictionary[(SettingsReader.Instance.GetSettings.atcTeamAI, Team.Attackers)], Team.Attackers);
|
||||
}
|
||||
for (int i = 0; i < SettingsReader.Instance.GetSettings.numOfAttackers - (SettingsReader.Instance.GetSettings.hasHumanDefender ? 1 : 0); i++)
|
||||
{
|
||||
spawnCharacter(behaviourDictionary[(SettingsReader.Instance.GetSettings.defTeamAI, Team.Defenders)], Team.Defenders);
|
||||
}
|
||||
}
|
||||
|
||||
private void spawnCharacter(Func<NPC, BaseBehaviour> behaviourFunc, Team team)
|
||||
{
|
||||
var spawnPoint = team == Team.Defenders ?
|
||||
defendersSpawnPoints[random.Next(0, defendersSpawnPoints.Count)].position :
|
||||
attackersSpawnPoints[random.Next(0, attackersSpawnPoints.Count)].position;
|
||||
var entity = Instantiate(botPrefab, spawnPoint, Quaternion.identity);
|
||||
var npc = entity.GetComponent<NPC>();
|
||||
npc.SetBehaviour(behaviourFunc(npc));
|
||||
}
|
||||
}
|
||||
|
@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 672f5411fc3ccb74d8a17a6efdee9df4
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,4 +0,0 @@
|
||||
public class CharacterPooler
|
||||
{
|
||||
|
||||
}
|
22
Assets/Scripts/Character/Character.cs
Normal file
22
Assets/Scripts/Character/Character.cs
Normal file
@ -0,0 +1,22 @@
|
||||
using UnityEngine;
|
||||
public class Character
|
||||
{
|
||||
public Team Team { get; set; }
|
||||
public float LastTimeHit = 0;
|
||||
public CharacterCondition Condition;
|
||||
|
||||
public Character()
|
||||
{
|
||||
Condition = new CharacterCondition();
|
||||
}
|
||||
|
||||
public void ResetCharacter()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public interface ICharacter
|
||||
{
|
||||
Character GetCharacter { get; }
|
||||
}
|
2
Assets/Scripts/Bots/Behaviours/BehaviourClasses/DumbDefender.cs.meta → Assets/Scripts/Character/Character.cs.meta
generated
Executable file → Normal file
2
Assets/Scripts/Bots/Behaviours/BehaviourClasses/DumbDefender.cs.meta → Assets/Scripts/Character/Character.cs.meta
generated
Executable file → Normal file
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 64552bae354dc614d8012f07511a51e8
|
||||
guid: 44d6a17ad31b31241928e1a17e9aba37
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
@ -1,39 +1,62 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
public class CharacterCondition : MonoBehaviour
|
||||
|
||||
public class CharacterCondition
|
||||
{
|
||||
public event Action<object> OnKilledEvent;
|
||||
public event Action<int> OnDamageHealthTakenEvent;
|
||||
public event Action<int> OnDamageArmourTakenEvent;
|
||||
public event Action<int> OnAmmunitionTakenEvent;
|
||||
public event Action<int> OnChangeHealthEvent;
|
||||
public event Action<int> OnChangeArmourEvent;
|
||||
public event Action<int> OnChangeAmmunitionEvent;
|
||||
|
||||
[SerializeField] private int HealthPoints;
|
||||
[SerializeField] private int ArmourPoints;
|
||||
[SerializeField] private int Ammunition;
|
||||
|
||||
public void Start()
|
||||
{
|
||||
|
||||
private int health;
|
||||
public int HealthPoints
|
||||
{
|
||||
get
|
||||
{
|
||||
return health;
|
||||
}
|
||||
private set
|
||||
{
|
||||
health = value;
|
||||
OnChangeHealthEvent?.Invoke(value);
|
||||
}
|
||||
}
|
||||
|
||||
public void GetDamage(float damage)
|
||||
private int armour;
|
||||
public int ArmourPoints
|
||||
{
|
||||
HealthPoints -= Mathf.RoundToInt(damage * (1 - ArmourPoints * 0.5f));
|
||||
ArmourPoints -= Mathf.RoundToInt(Mathf.Sqrt(damage) * 5);
|
||||
|
||||
OnDamageHealthTakenEvent?.Invoke(HealthPoints);
|
||||
OnDamageArmourTakenEvent?.Invoke(ArmourPoints);
|
||||
if (HealthPoints < 0)
|
||||
OnKilledEvent?.Invoke(gameObject);
|
||||
get
|
||||
{
|
||||
return armour;
|
||||
}
|
||||
private set
|
||||
{
|
||||
armour = value;
|
||||
OnChangeArmourEvent?.Invoke(value);
|
||||
}
|
||||
}
|
||||
private int ammo;
|
||||
public int Ammunition
|
||||
{
|
||||
get
|
||||
{
|
||||
return ammo;
|
||||
}
|
||||
private set
|
||||
{
|
||||
ammo = value;
|
||||
OnChangeAmmunitionEvent?.Invoke(value);
|
||||
}
|
||||
}
|
||||
|
||||
public CharacterCondition()
|
||||
{
|
||||
var settings = SettingsReader.Instance.GetSettings;
|
||||
ammo = settings.maxAmmo;
|
||||
health = settings.maxHealth;
|
||||
armour = settings.maxArmour;
|
||||
}
|
||||
|
||||
public void GiveHealth(int health) => HealthPoints = Mathf.Clamp(health + HealthPoints, 0, 100);
|
||||
public void SetHealth(int health) => HealthPoints = Mathf.Clamp(health, 0, 100);
|
||||
public void GiveArmour(int armour) => ArmourPoints = Mathf.Clamp(armour + ArmourPoints, 0, 100);
|
||||
public void SetArmour(int armour) => ArmourPoints = Mathf.Clamp(armour, 0, 100);
|
||||
public void TakeAmmo(int ammo)
|
||||
{
|
||||
Ammunition += ammo;
|
||||
OnAmmunitionTakenEvent?.Invoke(Ammunition);
|
||||
}
|
||||
public void TakeAmmo(int ammo) => Ammunition += ammo;
|
||||
}
|
24
Assets/Scripts/Character/MovementController.cs
Executable file → Normal file
24
Assets/Scripts/Character/MovementController.cs
Executable file → Normal file
@ -7,7 +7,6 @@ using UnityEngine.AI;
|
||||
public class MovementController : MonoBehaviour
|
||||
{
|
||||
public NavPoint currentPosition { get; private set; }
|
||||
[SerializeField] private MapManager mapManager;
|
||||
[SerializeField] private NavMeshAgent navMeshAgent;
|
||||
|
||||
private void Start()
|
||||
@ -15,24 +14,19 @@ public class MovementController : MonoBehaviour
|
||||
navMeshAgent.speed = SettingsReader.Instance.GetSettings.movementSpeed;
|
||||
}
|
||||
|
||||
public void Move()
|
||||
{
|
||||
var pointCandidate = getPointCandidate();
|
||||
goToNextNavPoint(pointCandidate);
|
||||
public void MoveToRandomPoint()
|
||||
{
|
||||
Debug.Log(MapManager.navPoints == null);
|
||||
goToNextNavPoint(MapManager.navPoints[Random.Range(0, MapManager.navPoints.Count)]);
|
||||
}
|
||||
|
||||
|
||||
// todo внутри сенсора передавать в mlagents как variable length observations: https://github.com/Unity-Technologies/ml-agents/blob/main/docs/Learning-Environment-Design-Agents.md#variable-length-observations
|
||||
private NavPoint getPointCandidate()
|
||||
public List<NavPoint> getPointsCandidate()
|
||||
{
|
||||
var NavPointsPositions = mapManager.navPoints
|
||||
.Select(point => point.transform.position)
|
||||
.Where(point => (currentPosition.transform.position - point).magnitude <= SettingsReader.Instance.GetSettings.movementSpeed)
|
||||
return MapManager.navPoints
|
||||
.Where(point => (currentPosition.position - point.position).magnitude <= SettingsReader.Instance.GetSettings.movementSpeed)
|
||||
.ToList();
|
||||
//TODO AI
|
||||
return null;
|
||||
}
|
||||
|
||||
private void goToNextNavPoint(NavPoint destination) =>
|
||||
navMeshAgent.SetDestination(destination.transform.position);
|
||||
public void goToNextNavPoint(NavPoint destination) =>
|
||||
navMeshAgent.SetDestination(destination.position);
|
||||
}
|
||||
|
118
Assets/Scripts/Character/NPC.cs
Executable file → Normal file
118
Assets/Scripts/Character/NPC.cs
Executable file → Normal file
@ -1,37 +1,117 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using Unity.MLAgents;
|
||||
using Unity.MLAgents.Sensors;
|
||||
using Unity.MLAgents.Actuators;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public class NPC : Agent
|
||||
[RequireComponent(typeof(MovementController))]
|
||||
public class NPC : Agent, ICharacter
|
||||
{
|
||||
public float LastTimeHit;
|
||||
private BaseBehaviour NPCBehaviour;
|
||||
public List<Action> ActionList;
|
||||
|
||||
[SerializeField]
|
||||
private List<ISensor> SensorList; // todo тут интерфейс должен быть наш
|
||||
[HideInInspector]
|
||||
public Character AgentCharacter;
|
||||
public CharacterCondition Condition;
|
||||
|
||||
public void SetBehaviour(BaseBehaviour behaviour) => NPCBehaviour = behaviour;
|
||||
public Team Team { get; set; }
|
||||
public NPC_BaseState NPC_State { get; private set; }
|
||||
|
||||
public Character GetCharacter => AgentCharacter;
|
||||
|
||||
private NPC_DirectPointState DirectState;
|
||||
private NPC_InCoverState CoverState;
|
||||
private NPC_RunningState RunningState;
|
||||
|
||||
private MovementController moveController;
|
||||
private BufferSensorComponent bufferSensor;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
DirectState = new NPC_DirectPointState();
|
||||
CoverState = new NPC_InCoverState();
|
||||
RunningState = new NPC_RunningState();
|
||||
NPC_State = DirectState;
|
||||
|
||||
AgentCharacter = new Character();
|
||||
Condition = AgentCharacter.Condition;
|
||||
}
|
||||
private void Start()
|
||||
{
|
||||
|
||||
AgentCharacter = new Character();
|
||||
Condition = AgentCharacter.Condition;
|
||||
|
||||
moveController = gameObject.GetComponent<MovementController>();
|
||||
bufferSensor = gameObject.GetComponent<BufferSensorComponent>();
|
||||
|
||||
GameManager.OnResetScene += AgentCharacter.ResetCharacter;
|
||||
}
|
||||
|
||||
|
||||
public override void OnEpisodeBegin()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void CollectObservations(VectorSensor sensor)
|
||||
{
|
||||
// Target and Agent positions
|
||||
foreach (var _sensor in SensorList)
|
||||
sensor.AddObservation(Condition.HealthPoints);
|
||||
sensor.AddObservation(Condition.ArmourPoints);
|
||||
sensor.AddObservation(Condition.Ammunition);
|
||||
sensor.AddObservation((int)NPC_State.State);
|
||||
|
||||
|
||||
|
||||
var candidates = moveController.getPointsCandidate();
|
||||
foreach (var point in candidates)
|
||||
{
|
||||
sensor.AddObservation(1); // todo
|
||||
// sensor.AddObservation(_sensor.GetValue());
|
||||
|
||||
bufferSensor.AppendObservation(new float[] {
|
||||
//1 position in navpointId
|
||||
(float)moveController.currentPosition.PointId,
|
||||
//2 distance to flag
|
||||
moveController.currentPosition.FlagDistance,
|
||||
//3 death count in point
|
||||
moveController.currentPosition.DeathAttr,
|
||||
//4 flagEnemyDistance
|
||||
GameManager.IsCloserToFlagFromNextNavPoint(point, transform.position)==true?1:0,
|
||||
//5 EnemyVsNavPointDistance
|
||||
GameManager.IsCloserToEnemyThanToNextNavPoint(point,transform.position, AgentCharacter.Team)==true?1:0
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void Update()
|
||||
|
||||
public override void Heuristic(in ActionBuffers actionsOut)
|
||||
{
|
||||
//NPCBehaviour.DoAction();
|
||||
var discreteActionsOut = actionsOut.DiscreteActions;
|
||||
if (Input.GetKeyDown(KeyCode.W))
|
||||
{
|
||||
discreteActionsOut[0] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnActionReceived(ActionBuffers actions)
|
||||
{
|
||||
if (actions.DiscreteActions[0] == 1)
|
||||
{
|
||||
moveController.MoveToRandomPoint();
|
||||
NPC_State = RunningState;
|
||||
}
|
||||
}
|
||||
|
||||
public event Action<object> OnKilledEvent;
|
||||
public void GetDamage(float damage)
|
||||
{
|
||||
AgentCharacter.LastTimeHit = TimeManager.Instance.CurrentTime;
|
||||
Condition.GiveHealth(-Mathf.RoundToInt(damage * (1 - Condition.ArmourPoints * 0.5f)));
|
||||
Condition.GiveArmour(-Mathf.RoundToInt(Mathf.Sqrt(damage) * 5));
|
||||
|
||||
if (Condition.HealthPoints < 0)
|
||||
{
|
||||
OnKilledEvent?.Invoke(this);
|
||||
moveController.currentPosition.DeathAttr += 1;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
Debug.LogWarning("Pooled object was destroyed");
|
||||
}
|
||||
}
|
||||
|
46
Assets/Scripts/Character/NPC_State.cs
Normal file
46
Assets/Scripts/Character/NPC_State.cs
Normal file
@ -0,0 +1,46 @@
|
||||
public enum NPC_EnumState
|
||||
{
|
||||
InCover,
|
||||
InDirectPoint,
|
||||
InRunning,
|
||||
}
|
||||
|
||||
public interface NPC_BaseState
|
||||
{
|
||||
NPC_EnumState State { get; }
|
||||
bool InCover { get; }
|
||||
bool IsRunning { get; }
|
||||
bool InDirectPoint { get; }
|
||||
float HitChance { get; }
|
||||
float DoDamageChance { get; }
|
||||
}
|
||||
|
||||
public class NPC_DirectPointState : NPC_BaseState
|
||||
{
|
||||
public bool InCover => false;
|
||||
public bool IsRunning => false;
|
||||
public bool InDirectPoint => false;
|
||||
public float HitChance => SettingsReader.Instance.GetSettings.GetHitChanceInDirectPoint;
|
||||
public float DoDamageChance => SettingsReader.Instance.GetSettings.DoDamageChanceInDirectPoint;
|
||||
public NPC_EnumState State => NPC_EnumState.InDirectPoint;
|
||||
}
|
||||
|
||||
public class NPC_RunningState : NPC_BaseState
|
||||
{
|
||||
public bool InCover => false;
|
||||
public bool IsRunning => true;
|
||||
public bool InDirectPoint => false;
|
||||
public float HitChance => SettingsReader.Instance.GetSettings.GetHitChanceInRunning;
|
||||
public float DoDamageChance => SettingsReader.Instance.GetSettings.DoDamageChanceInRunning;
|
||||
public NPC_EnumState State => NPC_EnumState.InRunning;
|
||||
}
|
||||
|
||||
public class NPC_InCoverState : NPC_BaseState
|
||||
{
|
||||
public bool InCover => true;
|
||||
public bool IsRunning => false;
|
||||
public bool InDirectPoint => false;
|
||||
public float HitChance => SettingsReader.Instance.GetSettings.GetHitChanceInCover;
|
||||
public float DoDamageChance => SettingsReader.Instance.GetSettings.DoDamageChanceInCover;
|
||||
public NPC_EnumState State => NPC_EnumState.InCover;
|
||||
}
|
2
Assets/Scripts/Bots/Behaviours/BehaviourClasses/DumbAttacker.cs.meta → Assets/Scripts/Character/NPC_State.cs.meta
generated
Executable file → Normal file
2
Assets/Scripts/Bots/Behaviours/BehaviourClasses/DumbAttacker.cs.meta → Assets/Scripts/Character/NPC_State.cs.meta
generated
Executable file → Normal file
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 138d13d4fe8a06444acb1da6bfc55aa7
|
||||
guid: a192e433e26797745ad0b46de2586de3
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
34
Assets/Scripts/Character/Player.cs
Normal file
34
Assets/Scripts/Character/Player.cs
Normal file
@ -0,0 +1,34 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
public class Player : MonoBehaviour, ICharacter
|
||||
{
|
||||
[HideInInspector]
|
||||
public Character PlayerCharacter;
|
||||
public CharacterCondition Condition;
|
||||
|
||||
public Character GetCharacter => PlayerCharacter;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
PlayerCharacter = new Character();
|
||||
Condition = PlayerCharacter.Condition;
|
||||
GameManager.OnResetScene += PlayerCharacter.ResetCharacter;
|
||||
}
|
||||
|
||||
public event Action<object> OnKilledEvent;
|
||||
public void GetDamage(float damage)
|
||||
{
|
||||
PlayerCharacter.LastTimeHit = TimeManager.Instance.CurrentTime;
|
||||
Condition.GiveHealth(-Mathf.RoundToInt(damage * (1 - Condition.ArmourPoints * 0.5f)));
|
||||
Condition.GiveArmour(-Mathf.RoundToInt(Mathf.Sqrt(damage) * 5));
|
||||
|
||||
if (Condition.HealthPoints < 0)
|
||||
OnKilledEvent?.Invoke(this);
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
Debug.LogWarning("Pooled object was destroyed");
|
||||
}
|
||||
}
|
2
Assets/Scripts/Bots/Behaviours/BaseBehaviour.cs.meta → Assets/Scripts/Character/Player.cs.meta
generated
Executable file → Normal file
2
Assets/Scripts/Bots/Behaviours/BaseBehaviour.cs.meta → Assets/Scripts/Character/Player.cs.meta
generated
Executable file → Normal file
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 60bdb2d866ca9324cbe3639e7c47ae23
|
||||
guid: a8c9a8e604d395c4ab9d03d28adc4982
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
@ -1,14 +1,14 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEditorInternal;
|
||||
using Unity.MLAgents;
|
||||
using UnityEngine;
|
||||
|
||||
public class GameManager : MonoBehaviour
|
||||
{
|
||||
|
||||
private static GameManager instance;
|
||||
public static GameManager Instance { get { return instance; } }
|
||||
|
||||
private static SimpleMultiAgentGroup DefendersTeam = new SimpleMultiAgentGroup();
|
||||
private static SimpleMultiAgentGroup AttackersTeam = new SimpleMultiAgentGroup();
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
if (Instance == null)
|
||||
@ -21,13 +21,36 @@ public class GameManager : MonoBehaviour
|
||||
{
|
||||
GlobalEventManager.onCaptureFlag += flagCaptured;
|
||||
GlobalEventManager.onTimeLeft += timeOut;
|
||||
|
||||
var agents = GameObject.FindObjectsOfType<Agent>();
|
||||
foreach (var item in agents)
|
||||
{
|
||||
var agent = item as NPC;
|
||||
if (agent.GetCharacter.Team == Team.Attackers)
|
||||
AttackersTeam.RegisterAgent(agent);
|
||||
else
|
||||
DefendersTeam.RegisterAgent(agent);
|
||||
}
|
||||
}
|
||||
|
||||
private void Update()
|
||||
public static bool IsCloserToEnemyThanToNextNavPoint(NavPoint navPoint, Vector3 currentTransform, Team team)
|
||||
{
|
||||
|
||||
SimpleMultiAgentGroup agentGroup;
|
||||
if (team == Team.Attackers)
|
||||
agentGroup = AttackersTeam;
|
||||
else
|
||||
agentGroup = DefendersTeam;
|
||||
|
||||
var distToNavPoint = (currentTransform - navPoint.position).magnitude;
|
||||
foreach (var agent in agentGroup.GetRegisteredAgents())
|
||||
if (distToNavPoint > (currentTransform - agent.transform.position).magnitude)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
public static bool IsCloserToFlagFromNextNavPoint(NavPoint navPoint, Vector3 currentTransform)
|
||||
=> navPoint.FlagDistance < (currentTransform - GameObject.FindGameObjectWithTag("Flag").transform.position).magnitude;
|
||||
|
||||
private void flagCaptured(Team team)
|
||||
{
|
||||
switch(team)
|
||||
|
@ -3,11 +3,17 @@ using UnityEngine;
|
||||
|
||||
public class MapManager : MonoBehaviour
|
||||
{
|
||||
public List<NavPoint> navPoints { get; private set; }
|
||||
public static List<NavPoint> navPoints { get; private set; }
|
||||
private void Start()
|
||||
{
|
||||
var i = 0;
|
||||
navPoints = new List<NavPoint>();
|
||||
var navPointsGameObj = GameObject.FindGameObjectsWithTag("Point");
|
||||
foreach (var gameobj in navPointsGameObj)
|
||||
navPoints.Add(gameobj.GetComponent<NavPoint>());
|
||||
{
|
||||
var navpoint = gameobj.GetComponent<NavPoint>();
|
||||
navpoint.PointId = i; i++;
|
||||
navPoints.Add(navpoint);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4,8 +4,10 @@ using UnityEngine;
|
||||
|
||||
public class TimeManager : MonoBehaviour
|
||||
{
|
||||
public static TimeManager instance = null;
|
||||
public float CurrentTime;
|
||||
private static TimeManager instance;
|
||||
public static TimeManager Instance { get { return instance; } }
|
||||
|
||||
public float CurrentTime { get; private set; }
|
||||
void Start()
|
||||
{
|
||||
if (instance == null)
|
||||
|
@ -17,7 +17,6 @@ public class FlagZone : MonoBehaviour
|
||||
{
|
||||
|
||||
timeForWin = SettingsReader.Instance.GetSettings.timeToWin;
|
||||
Debug.Log("32");
|
||||
TimeStayAttackers = 0;
|
||||
TimeStayDefenders = 0;
|
||||
occupAttackers = 0;
|
||||
|
@ -6,22 +6,15 @@ public class NavPoint : MonoBehaviour
|
||||
{
|
||||
public Vector3 position => gameObject.transform.position;
|
||||
public float FlagDistance { get; private set; }
|
||||
[System.NonSerialized] public float DeathAttr;
|
||||
[System.NonSerialized] public List<Vector3> EnemiesSeen;
|
||||
|
||||
[HideInInspector]
|
||||
public int? PointId;
|
||||
public float DeathAttr = 0;
|
||||
public List<Vector3> EnemiesSeen = new List<Vector3>();
|
||||
//Here other attributes;
|
||||
|
||||
[SerializeField]
|
||||
public int PointId;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
//DO NOT DELETE
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
FlagDistance = (GameObject.FindGameObjectWithTag("Flag").transform.position - position).magnitude;
|
||||
EnemiesSeen = new List<Vector3>();
|
||||
DeathAttr = 0;
|
||||
FlagDistance = (GameObject.FindGameObjectWithTag("Flag").transform.position - position).magnitude;
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,8 @@
|
||||
[CreateAssetMenu(fileName ="Game Settings", menuName = "Game/Settings", order = 51)]
|
||||
public class Settings : ScriptableObject
|
||||
{
|
||||
public bool isTesting;
|
||||
|
||||
public float timeToWin;
|
||||
public float timeOut;
|
||||
|
||||
@ -21,4 +23,15 @@ public class Settings : ScriptableObject
|
||||
public int armourPickupAmount;
|
||||
public int ammunitionPickupAmount;
|
||||
public int pickupsAmount;
|
||||
|
||||
public int maxHealth;
|
||||
public int maxArmour;
|
||||
public int maxAmmo;
|
||||
|
||||
public float GetHitChanceInDirectPoint;
|
||||
public float GetHitChanceInRunning;
|
||||
public float GetHitChanceInCover;
|
||||
public float DoDamageChanceInDirectPoint;
|
||||
public float DoDamageChanceInRunning;
|
||||
public float DoDamageChanceInCover;
|
||||
}
|
||||
|
@ -9,7 +9,6 @@ public class SettingsReader : MonoBehaviour
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
Debug.Log("init");
|
||||
instance = this;
|
||||
}
|
||||
|
||||
|
@ -16,6 +16,14 @@ public class PickUpSpawner : MonoBehaviour
|
||||
|
||||
[SerializeField] private List<NavPoint> spawnPoints;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
if (instance == null)
|
||||
instance = this;
|
||||
else
|
||||
Destroy(gameObject);
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
pickups = new List<GameObject>();
|
||||
|
@ -1,5 +0,0 @@
|
||||
public interface ISensor<T>
|
||||
{
|
||||
T GetValue();
|
||||
SensorType GetSensorType();
|
||||
}
|
4
Assets/Scripts/Sensors/Sensors.cs
Normal file
4
Assets/Scripts/Sensors/Sensors.cs
Normal file
@ -0,0 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using Unity.MLAgents.Sensors;
|
||||
|
||||
|
0
Assets/Scripts/Sensors/ISensor.cs.meta → Assets/Scripts/Sensors/Sensors.cs.meta
generated
Executable file → Normal file
0
Assets/Scripts/Sensors/ISensor.cs.meta → Assets/Scripts/Sensors/Sensors.cs.meta
generated
Executable file → Normal file
@ -739,8 +739,4 @@ public abstract class DictionaryDrawer<TK, TV> : PropertyDrawer
|
||||
UnityEngine.Debug.Log(e.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable] public class DictionaryOfTeamsAndNavPoints : SerializableDictionary<Team, NavPoint> { }
|
||||
[CustomPropertyDrawer(typeof(DictionaryOfTeamsAndNavPoints))]
|
||||
public class DictionaryOfTeamsAndNavPointsDrawer : DictionaryDrawer<Team, NavPoint> { }
|
||||
}
|
16
Assets/Settings/Game Settings.asset
generated
16
Assets/Settings/Game Settings.asset
generated
@ -12,17 +12,27 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: e2c47233b9062c84482336b145c6891b, type: 3}
|
||||
m_Name: Game Settings
|
||||
m_EditorClassIdentifier:
|
||||
isTesting: 1
|
||||
timeToWin: 5
|
||||
timeOut: 1600
|
||||
movementDistance: 50
|
||||
movementSpeed: 3
|
||||
defTeamAI: 0
|
||||
atcTeamAI: 0
|
||||
numOfDefenders: 0
|
||||
numOfAttackers: 0
|
||||
hasHumanDefender: 0
|
||||
numOfDefenders: 1
|
||||
numOfAttackers: 1
|
||||
hasHumanDefender: 1
|
||||
hasHumanAttacker: 0
|
||||
healthPickupAmount: 50
|
||||
armourPickupAmount: 50
|
||||
ammunitionPickupAmount: 120
|
||||
pickupsAmount: 2
|
||||
maxHealth: 0
|
||||
maxArmour: 0
|
||||
maxAmmo: 0
|
||||
GetHitChanceInDirectPoint: 0
|
||||
GetHitChanceInRunning: 0
|
||||
GetHitChanceInCover: 0
|
||||
DoDamageChanceInDirectPoint: 0
|
||||
DoDamageChanceInRunning: 0
|
||||
DoDamageChanceInCover: 0
|
||||
|
0
Docs/api.md
Normal file
0
Docs/api.md
Normal file
@ -10,6 +10,7 @@
|
||||
"com.unity.test-framework": "1.1.30",
|
||||
"com.unity.textmeshpro": "2.1.6",
|
||||
"com.unity.timeline": "1.2.18",
|
||||
"com.unity.toolchain.win-x86_64-linux-x86_64": "2.0.0",
|
||||
"com.unity.ugui": "1.0.0",
|
||||
"com.unity.modules.ai": "1.0.0",
|
||||
"com.unity.modules.androidjni": "1.0.0",
|
||||
|
@ -102,6 +102,22 @@
|
||||
"dependencies": {},
|
||||
"url": "https://packages.unity.com"
|
||||
},
|
||||
"com.unity.sysroot": {
|
||||
"version": "2.0.0",
|
||||
"depth": 1,
|
||||
"source": "registry",
|
||||
"dependencies": {},
|
||||
"url": "https://packages.unity.com"
|
||||
},
|
||||
"com.unity.sysroot.linux-x86_64": {
|
||||
"version": "2.0.0",
|
||||
"depth": 1,
|
||||
"source": "registry",
|
||||
"dependencies": {
|
||||
"com.unity.sysroot": "2.0.0"
|
||||
},
|
||||
"url": "https://packages.unity.com"
|
||||
},
|
||||
"com.unity.test-framework": {
|
||||
"version": "1.1.30",
|
||||
"depth": 0,
|
||||
@ -134,6 +150,16 @@
|
||||
},
|
||||
"url": "https://packages.unity.com"
|
||||
},
|
||||
"com.unity.toolchain.win-x86_64-linux-x86_64": {
|
||||
"version": "2.0.0",
|
||||
"depth": 0,
|
||||
"source": "registry",
|
||||
"dependencies": {
|
||||
"com.unity.sysroot": "2.0.0",
|
||||
"com.unity.sysroot.linux-x86_64": "2.0.0"
|
||||
},
|
||||
"url": "https://packages.unity.com"
|
||||
},
|
||||
"com.unity.ugui": {
|
||||
"version": "1.0.0",
|
||||
"depth": 0,
|
||||
|
17
ProjectSettings/BurstAotSettings_StandaloneWindows.json
Normal file
17
ProjectSettings/BurstAotSettings_StandaloneWindows.json
Normal file
@ -0,0 +1,17 @@
|
||||
{
|
||||
"MonoBehaviour": {
|
||||
"Version": 4,
|
||||
"EnableBurstCompilation": true,
|
||||
"EnableOptimisations": true,
|
||||
"EnableSafetyChecks": false,
|
||||
"EnableDebugInAllBuilds": false,
|
||||
"UsePlatformSDKLinker": false,
|
||||
"CpuMinTargetX32": 0,
|
||||
"CpuMaxTargetX32": 0,
|
||||
"CpuMinTargetX64": 0,
|
||||
"CpuMaxTargetX64": 0,
|
||||
"CpuTargetsX32": 6,
|
||||
"CpuTargetsX64": 72,
|
||||
"OptimizeFor": 0
|
||||
}
|
||||
}
|
6
ProjectSettings/CommonBurstAotSettings.json
Normal file
6
ProjectSettings/CommonBurstAotSettings.json
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"MonoBehaviour": {
|
||||
"Version": 4,
|
||||
"DisabledWarnings": ""
|
||||
}
|
||||
}
|
2
ProjectSettings/NavMeshAreas.asset
generated
2
ProjectSettings/NavMeshAreas.asset
generated
@ -76,7 +76,7 @@ NavMeshProjectSettings:
|
||||
agentRadius: 0.5
|
||||
agentHeight: 2
|
||||
agentSlope: 45
|
||||
agentClimb: 0.75
|
||||
agentClimb: 0.1
|
||||
ledgeDropHeight: 0
|
||||
maxJumpAcrossDistance: 0
|
||||
minRegionArea: 2
|
||||
|
@ -73,6 +73,16 @@
|
||||
"key": "editor.closeWindowAfterShapeCreation",
|
||||
"value": "{\"m_Value\":false}"
|
||||
},
|
||||
{
|
||||
"type": "System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
|
||||
"key": "editor.showEditorNotifications",
|
||||
"value": "{\"m_Value\":false}"
|
||||
},
|
||||
{
|
||||
"type": "System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
|
||||
"key": "editor.stripProBuilderScriptsOnBuild",
|
||||
"value": "{\"m_Value\":true}"
|
||||
},
|
||||
{
|
||||
"type": "UnityEngine.ProBuilder.SelectionModifierBehavior, Unity.ProBuilder, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null",
|
||||
"key": "editor.rectSelectModifier",
|
||||
@ -117,6 +127,11 @@
|
||||
"type": "UnityEngine.ProBuilder.UnwrapParameters, Unity.ProBuilder, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null",
|
||||
"key": "lightmapping.defaultLightmapUnwrapParameters",
|
||||
"value": "{\"m_Value\":{\"m_HardAngle\":88.0,\"m_PackMargin\":20.0,\"m_AngleError\":8.0,\"m_AreaError\":15.0}}"
|
||||
},
|
||||
{
|
||||
"type": "System.Single, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
|
||||
"key": "uv.uvEditorGridSnapIncrement",
|
||||
"value": "{\"m_Value\":0.125}"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
3
ProjectSettings/ProjectSettings.asset
generated
3
ProjectSettings/ProjectSettings.asset
generated
@ -631,7 +631,8 @@ PlayerSettings:
|
||||
gcIncremental: 0
|
||||
assemblyVersionValidation: 1
|
||||
gcWBarrierValidation: 0
|
||||
apiCompatibilityLevelPerPlatform: {}
|
||||
apiCompatibilityLevelPerPlatform:
|
||||
Standalone: 3
|
||||
m_RenderingPath: 1
|
||||
m_MobileRenderingPath: 1
|
||||
metroPackageName: Template_3D
|
||||
|
@ -1,2 +1,2 @@
|
||||
m_EditorVersion: 2019.4.35f1
|
||||
m_EditorVersionWithRevision: 2019.4.35f1 (0462406dff2e)
|
||||
m_EditorVersion: 2019.4.36f1
|
||||
m_EditorVersionWithRevision: 2019.4.36f1 (660c164b2fc5)
|
||||
|
Reference in New Issue
Block a user