Basic entities move into atk range to target
This commit is contained in:
parent
9a98d56c95
commit
10e9fc074b
54
.vscode/launch.json
vendored
Normal file
54
.vscode/launch.json
vendored
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
{
|
||||||
|
// Use IntelliSense to learn about possible attributes.
|
||||||
|
// Hover to view descriptions of existing attributes.
|
||||||
|
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||||
|
"version": "0.2.0",
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"name": "Unity Editor",
|
||||||
|
"type": "unity",
|
||||||
|
"path": "/D:/Soulaha_Balde/Documents/ETS/Conjure/ludumdare50/Library/EditorInstance.json",
|
||||||
|
"request": "launch"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Windows Player",
|
||||||
|
"type": "unity",
|
||||||
|
"request": "launch"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "OSX Player",
|
||||||
|
"type": "unity",
|
||||||
|
"request": "launch"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Linux Player",
|
||||||
|
"type": "unity",
|
||||||
|
"request": "launch"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "iOS Player",
|
||||||
|
"type": "unity",
|
||||||
|
"request": "launch"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Android Player",
|
||||||
|
"type": "unity",
|
||||||
|
"request": "launch"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Xbox One Player",
|
||||||
|
"type": "unity",
|
||||||
|
"request": "launch"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "PS4 Player",
|
||||||
|
"type": "unity",
|
||||||
|
"request": "launch"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "SwitchPlayer",
|
||||||
|
"type": "unity",
|
||||||
|
"request": "launch"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
55
.vscode/settings.json
vendored
Normal file
55
.vscode/settings.json
vendored
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
{
|
||||||
|
"files.exclude":
|
||||||
|
{
|
||||||
|
"**/.DS_Store":true,
|
||||||
|
"**/.git":true,
|
||||||
|
"**/.gitmodules":true,
|
||||||
|
"**/*.booproj":true,
|
||||||
|
"**/*.pidb":true,
|
||||||
|
"**/*.suo":true,
|
||||||
|
"**/*.user":true,
|
||||||
|
"**/*.userprefs":true,
|
||||||
|
"**/*.unityproj":true,
|
||||||
|
"**/*.dll":true,
|
||||||
|
"**/*.exe":true,
|
||||||
|
"**/*.pdf":true,
|
||||||
|
"**/*.mid":true,
|
||||||
|
"**/*.midi":true,
|
||||||
|
"**/*.wav":true,
|
||||||
|
"**/*.gif":true,
|
||||||
|
"**/*.ico":true,
|
||||||
|
"**/*.jpg":true,
|
||||||
|
"**/*.jpeg":true,
|
||||||
|
"**/*.png":true,
|
||||||
|
"**/*.psd":true,
|
||||||
|
"**/*.tga":true,
|
||||||
|
"**/*.tif":true,
|
||||||
|
"**/*.tiff":true,
|
||||||
|
"**/*.3ds":true,
|
||||||
|
"**/*.3DS":true,
|
||||||
|
"**/*.fbx":true,
|
||||||
|
"**/*.FBX":true,
|
||||||
|
"**/*.lxo":true,
|
||||||
|
"**/*.LXO":true,
|
||||||
|
"**/*.ma":true,
|
||||||
|
"**/*.MA":true,
|
||||||
|
"**/*.obj":true,
|
||||||
|
"**/*.OBJ":true,
|
||||||
|
"**/*.asset":true,
|
||||||
|
"**/*.cubemap":true,
|
||||||
|
"**/*.flare":true,
|
||||||
|
"**/*.mat":true,
|
||||||
|
"**/*.meta":true,
|
||||||
|
"**/*.prefab":true,
|
||||||
|
"**/*.unity":true,
|
||||||
|
"build/":true,
|
||||||
|
"Build/":true,
|
||||||
|
"Library/":true,
|
||||||
|
"library/":true,
|
||||||
|
"obj/":true,
|
||||||
|
"Obj/":true,
|
||||||
|
"ProjectSettings/":true,
|
||||||
|
"temp/":true,
|
||||||
|
"Temp/":true
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -218,6 +218,7 @@ GameObject:
|
|||||||
- component: {fileID: 1736226634}
|
- component: {fileID: 1736226634}
|
||||||
- component: {fileID: 1736226633}
|
- component: {fileID: 1736226633}
|
||||||
- component: {fileID: 1736226632}
|
- component: {fileID: 1736226632}
|
||||||
|
- component: {fileID: 1736226636}
|
||||||
m_Layer: 0
|
m_Layer: 0
|
||||||
m_Name: Cube
|
m_Name: Cube
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
@ -301,3 +302,117 @@ Transform:
|
|||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
m_RootOrder: 1
|
m_RootOrder: 1
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!114 &1736226636
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1736226631}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: ea4f715fcb3a0324a9e5d7c1ac896b9d, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
health: 0
|
||||||
|
movementSpeed: 3
|
||||||
|
rotSpeed: 10
|
||||||
|
fov: 30
|
||||||
|
attackRange: 1.5
|
||||||
|
attackDmg: 0
|
||||||
|
target: {fileID: 1996499837}
|
||||||
|
--- !u!1 &1996499833
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 1996499837}
|
||||||
|
- component: {fileID: 1996499836}
|
||||||
|
- component: {fileID: 1996499835}
|
||||||
|
- component: {fileID: 1996499834}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: Target
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!135 &1996499834
|
||||||
|
SphereCollider:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1996499833}
|
||||||
|
m_Material: {fileID: 0}
|
||||||
|
m_IsTrigger: 0
|
||||||
|
m_Enabled: 1
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Radius: 0.5
|
||||||
|
m_Center: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!23 &1996499835
|
||||||
|
MeshRenderer:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1996499833}
|
||||||
|
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_RayTraceProcedural: 0
|
||||||
|
m_RenderingLayerMask: 1
|
||||||
|
m_RendererPriority: 0
|
||||||
|
m_Materials:
|
||||||
|
- {fileID: 2100000, guid: 31321ba15b8f8eb4c954353edc038b1d, type: 2}
|
||||||
|
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
|
||||||
|
m_AdditionalVertexStreams: {fileID: 0}
|
||||||
|
--- !u!33 &1996499836
|
||||||
|
MeshFilter:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1996499833}
|
||||||
|
m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0}
|
||||||
|
--- !u!4 &1996499837
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1996499833}
|
||||||
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
|
m_LocalPosition: {x: 6.2, y: -2.69, z: -0.43858913}
|
||||||
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
|
m_Children: []
|
||||||
|
m_Father: {fileID: 0}
|
||||||
|
m_RootOrder: 2
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
|||||||
53
Assets/Scripts/Entity.cs
Normal file
53
Assets/Scripts/Entity.cs
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
public class Entity : MonoBehaviour
|
||||||
|
{
|
||||||
|
[SerializeField]private float health;
|
||||||
|
[SerializeField]private float movementSpeed;
|
||||||
|
[SerializeField]private float rotSpeed;
|
||||||
|
[SerializeField]private float fov;
|
||||||
|
[SerializeField]private float attackRange;
|
||||||
|
[SerializeField]private float attackDmg;
|
||||||
|
[SerializeField]private Transform target;
|
||||||
|
private Vector3 direction;
|
||||||
|
|
||||||
|
public Entity(float health, float movementSpeed, float rotSpeed, float attackRange, float attackDmg, Transform target){
|
||||||
|
this.health = health;
|
||||||
|
this.movementSpeed = movementSpeed;
|
||||||
|
this.rotSpeed = rotSpeed;
|
||||||
|
this.attackRange = attackRange;
|
||||||
|
this.attackDmg = attackDmg;
|
||||||
|
this.target = target;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Start() {
|
||||||
|
direction = new Vector3(1,0,0);
|
||||||
|
}
|
||||||
|
private void Update() {
|
||||||
|
MoveToTarget(transform, Time.deltaTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected virtual void Attack(){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected virtual void SpecialAttack(){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected virtual void MoveToTarget(Transform transform, float deltaTime){
|
||||||
|
direction = Vector3.RotateTowards(direction, (target.position - transform.position), rotSpeed*deltaTime, 0.0f);
|
||||||
|
if( !IsInAttackRange())
|
||||||
|
transform.Translate(direction * movementSpeed* deltaTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetTarget(Transform newTarget){
|
||||||
|
target = newTarget;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected bool IsInAttackRange(){
|
||||||
|
return Vector2.Distance(transform.position, target.position) <= attackRange;
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Assets/Scripts/Entity.cs.meta
Normal file
11
Assets/Scripts/Entity.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: ea4f715fcb3a0324a9e5d7c1ac896b9d
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@ -582,8 +582,8 @@ PlayerSettings:
|
|||||||
apiCompatibilityLevelPerPlatform: {}
|
apiCompatibilityLevelPerPlatform: {}
|
||||||
m_RenderingPath: 1
|
m_RenderingPath: 1
|
||||||
m_MobileRenderingPath: 1
|
m_MobileRenderingPath: 1
|
||||||
metroPackageName: 2D_BuiltInRenderer
|
metroPackageName: 2DBuiltInRenderer
|
||||||
metroPackageVersion:
|
metroPackageVersion: 1.0.0.0
|
||||||
metroCertificatePath:
|
metroCertificatePath:
|
||||||
metroCertificatePassword:
|
metroCertificatePassword:
|
||||||
metroCertificateSubject:
|
metroCertificateSubject:
|
||||||
@ -591,7 +591,7 @@ PlayerSettings:
|
|||||||
metroCertificateNotAfter: 0000000000000000
|
metroCertificateNotAfter: 0000000000000000
|
||||||
metroApplicationDescription: 2D_BuiltInRenderer
|
metroApplicationDescription: 2D_BuiltInRenderer
|
||||||
wsaImages: {}
|
wsaImages: {}
|
||||||
metroTileShortName:
|
metroTileShortName: ConjureLudumDare50
|
||||||
metroTileShowName: 0
|
metroTileShowName: 0
|
||||||
metroMediumTileShowName: 0
|
metroMediumTileShowName: 0
|
||||||
metroLargeTileShowName: 0
|
metroLargeTileShowName: 0
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user