Charles

Updated Enemy to allow multiple attackers

Showing 60 changed files with 204 additions and 265 deletions
fileFormatVersion: 2
guid: f2c1d48120ff49c419050488b5fdfe8d
ModelImporter:
serializedVersion: 25
serializedVersion: 20200
internalIDToNameTable:
- first:
1: 100000
......@@ -455,7 +455,7 @@ ModelImporter:
second: Sword
externalObjects: {}
materials:
importMaterials: 0
materialImportMode: 0
materialName: 0
materialSearch: 1
materialLocation: 0
......@@ -464,7 +464,7 @@ ModelImporter:
bakeSimulation: 0
resampleCurves: 1
optimizeGameObjects: 0
motionNodeName: Motion
motionNodeName:
rigImportErrors:
rigImportWarnings:
animationImportErrors:
......@@ -499,9 +499,9 @@ ModelImporter:
loopBlendPositionY: 1
loopBlendPositionXZ: 0
keepOriginalOrientation: 1
keepOriginalPositionY: 1
keepOriginalPositionY: 0
keepOriginalPositionXZ: 1
heightFromFeet: 0
heightFromFeet: 1
mirror: 0
bodyMask: 01000000010000000100000001000000010000000100000001000000010000000100000001000000010000000100000001000000
curves: []
......@@ -625,15 +625,18 @@ ModelImporter:
meshCompression: 0
addColliders: 0
useSRGBMaterialColor: 1
sortHierarchyByName: 1
importVisibility: 0
importBlendShapes: 0
importCameras: 0
importLights: 0
fileIdsGeneration: 1
swapUVChannels: 0
generateSecondaryUV: 0
useFileUnits: 1
keepQuads: 0
weldVertices: 0
bakeAxisConversion: 0
preserveHierarchy: 0
skinWeightsMode: 0
maxBonesPerVertex: 4
......@@ -643,6 +646,9 @@ ModelImporter:
secondaryUVAngleDistortion: 8
secondaryUVAreaDistortion: 15.000001
secondaryUVHardAngle: 88
secondaryUVMarginMethod: 0
secondaryUVMinLightmapResolution: 40
secondaryUVMinObjectScale: 1
secondaryUVPackMargin: 4
useFileScale: 0
tangentSpace:
......@@ -655,7 +661,6 @@ ModelImporter:
normalSmoothingSource: 0
referencedClips: []
importAnimation: 1
copyAvatar: 1
humanDescription:
serializedVersion: 3
human:
......@@ -1364,8 +1369,11 @@ ModelImporter:
skeletonHasParents: 0
lastHumanDescriptionAvatarSource: {fileID: 9000000, guid: 417a287abb2cab94889f1f1ddd91f928,
type: 3}
autoGenerateAvatarMappingIfUnspecified: 1
animationType: 3
humanoidOversampling: 1
avatarSetup: 2
addHumanoidExtraRootOnlyWhenUsingAvatar: 0
additionalBone: 0
userData:
assetBundleName:
......
fileFormatVersion: 2
guid: b093e573ca387a1459010ed43a16d2ad
ModelImporter:
serializedVersion: 25
serializedVersion: 20200
internalIDToNameTable:
- first:
1: 100000
......@@ -428,7 +428,7 @@ ModelImporter:
second: ImportLogs
externalObjects: {}
materials:
importMaterials: 0
materialImportMode: 0
materialName: 0
materialSearch: 1
materialLocation: 0
......@@ -437,14 +437,14 @@ ModelImporter:
bakeSimulation: 0
resampleCurves: 1
optimizeGameObjects: 0
motionNodeName: Motion
motionNodeName:
rigImportErrors:
rigImportWarnings:
animationImportErrors:
animationImportWarnings: "\nClip 'Take 001' has import animation warnings that
might lower retargeting quality:\nNote: Activate translation DOF on avatar to
improve retargeting quality.\n\t'B_Spine' has translation animation that will
be discarded.\n"
might lower retargeting quality:\nNote: Activate translation DOF on avatar
to improve retargeting quality.\n\t'B_Spine' has translation animation that
will be discarded.\n"
animationRetargetingWarnings:
animationDoRetargetingWarnings: 0
importAnimatedCustomProperties: 0
......@@ -475,27 +475,13 @@ ModelImporter:
loopBlendPositionY: 1
loopBlendPositionXZ: 0
keepOriginalOrientation: 1
keepOriginalPositionY: 1
keepOriginalPositionY: 0
keepOriginalPositionXZ: 1
heightFromFeet: 0
heightFromFeet: 1
mirror: 0
bodyMask: 01000000010000000100000001000000010000000100000001000000010000000100000001000000010000000100000001000000
bodyMask: 01000000010000000100000001000000010000000000000001000000010000000100000001000000010000000100000001000000
curves: []
events:
- time: 0.22826086
functionName: FootR
data:
objectReferenceParameter: {instanceID: 0}
floatParameter: 0
intParameter: 0
messageOptions: 0
- time: 0.7673913
functionName: FootL
data:
objectReferenceParameter: {instanceID: 0}
floatParameter: 0
intParameter: 0
messageOptions: 0
events: []
transformMask:
- path:
weight: 1
......@@ -615,15 +601,18 @@ ModelImporter:
meshCompression: 0
addColliders: 0
useSRGBMaterialColor: 1
sortHierarchyByName: 1
importVisibility: 0
importBlendShapes: 0
importCameras: 0
importLights: 0
fileIdsGeneration: 1
swapUVChannels: 0
generateSecondaryUV: 0
useFileUnits: 1
keepQuads: 0
weldVertices: 0
bakeAxisConversion: 0
preserveHierarchy: 0
skinWeightsMode: 0
maxBonesPerVertex: 4
......@@ -633,6 +622,9 @@ ModelImporter:
secondaryUVAngleDistortion: 8
secondaryUVAreaDistortion: 15.000001
secondaryUVHardAngle: 88
secondaryUVMarginMethod: 0
secondaryUVMinLightmapResolution: 40
secondaryUVMinObjectScale: 1
secondaryUVPackMargin: 4
useFileScale: 0
tangentSpace:
......@@ -645,7 +637,6 @@ ModelImporter:
normalSmoothingSource: 0
referencedClips: []
importAnimation: 1
copyAvatar: 1
humanDescription:
serializedVersion: 3
human:
......@@ -1354,8 +1345,11 @@ ModelImporter:
skeletonHasParents: 0
lastHumanDescriptionAvatarSource: {fileID: 9000000, guid: 417a287abb2cab94889f1f1ddd91f928,
type: 3}
autoGenerateAvatarMappingIfUnspecified: 1
animationType: 3
humanoidOversampling: 1
avatarSetup: 2
addHumanoidExtraRootOnlyWhenUsingAvatar: 0
additionalBone: 0
userData:
assetBundleName:
......
fileFormatVersion: 2
guid: 5d8ee6a4cdbcb0042a50ca001e7c45bf
ModelImporter:
serializedVersion: 25
serializedVersion: 20200
internalIDToNameTable:
- first:
1: 100000
......@@ -428,7 +428,7 @@ ModelImporter:
second: ImportLogs
externalObjects: {}
materials:
importMaterials: 0
materialImportMode: 0
materialName: 0
materialSearch: 1
materialLocation: 0
......@@ -437,14 +437,14 @@ ModelImporter:
bakeSimulation: 0
resampleCurves: 1
optimizeGameObjects: 0
motionNodeName: Motion
motionNodeName:
rigImportErrors:
rigImportWarnings:
animationImportErrors:
animationImportWarnings: "\nClip 'Take 001' has import animation warnings that
might lower retargeting quality:\nNote: Activate translation DOF on avatar to
improve retargeting quality.\n\t'B_Spine' has translation animation that will
be discarded.\n"
might lower retargeting quality:\nNote: Activate translation DOF on avatar
to improve retargeting quality.\n\t'B_Spine' has translation animation that
will be discarded.\n"
animationRetargetingWarnings:
animationDoRetargetingWarnings: 0
importAnimatedCustomProperties: 0
......@@ -475,27 +475,13 @@ ModelImporter:
loopBlendPositionY: 1
loopBlendPositionXZ: 0
keepOriginalOrientation: 1
keepOriginalPositionY: 1
keepOriginalPositionY: 0
keepOriginalPositionXZ: 1
heightFromFeet: 0
heightFromFeet: 1
mirror: 0
bodyMask: 01000000010000000100000001000000010000000100000001000000010000000100000001000000010000000100000001000000
curves: []
events:
- time: 0.36304346
functionName: FootR
data:
objectReferenceParameter: {instanceID: 0}
floatParameter: 0
intParameter: 0
messageOptions: 0
- time: 0.85
functionName: FootL
data:
objectReferenceParameter: {instanceID: 0}
floatParameter: 0
intParameter: 0
messageOptions: 0
events: []
transformMask:
- path:
weight: 1
......@@ -615,15 +601,18 @@ ModelImporter:
meshCompression: 0
addColliders: 0
useSRGBMaterialColor: 1
sortHierarchyByName: 1
importVisibility: 0
importBlendShapes: 0
importCameras: 0
importLights: 0
fileIdsGeneration: 1
swapUVChannels: 0
generateSecondaryUV: 0
useFileUnits: 1
keepQuads: 0
weldVertices: 0
bakeAxisConversion: 0
preserveHierarchy: 0
skinWeightsMode: 0
maxBonesPerVertex: 4
......@@ -633,6 +622,9 @@ ModelImporter:
secondaryUVAngleDistortion: 8
secondaryUVAreaDistortion: 15.000001
secondaryUVHardAngle: 88
secondaryUVMarginMethod: 0
secondaryUVMinLightmapResolution: 40
secondaryUVMinObjectScale: 1
secondaryUVPackMargin: 4
useFileScale: 0
tangentSpace:
......@@ -645,7 +637,6 @@ ModelImporter:
normalSmoothingSource: 0
referencedClips: []
importAnimation: 1
copyAvatar: 1
humanDescription:
serializedVersion: 3
human:
......@@ -1354,8 +1345,11 @@ ModelImporter:
skeletonHasParents: 0
lastHumanDescriptionAvatarSource: {fileID: 9000000, guid: 417a287abb2cab94889f1f1ddd91f928,
type: 3}
autoGenerateAvatarMappingIfUnspecified: 1
animationType: 3
humanoidOversampling: 1
avatarSetup: 2
addHumanoidExtraRootOnlyWhenUsingAvatar: 0
additionalBone: 0
userData:
assetBundleName:
......
fileFormatVersion: 2
guid: 0626e44600709ab4788de7419c037a8d
ModelImporter:
serializedVersion: 25
serializedVersion: 20200
internalIDToNameTable:
- first:
1: 100000
......@@ -470,7 +470,7 @@ ModelImporter:
second: ImportLogs
externalObjects: {}
materials:
importMaterials: 0
materialImportMode: 0
materialName: 0
materialSearch: 1
materialLocation: 0
......@@ -484,9 +484,9 @@ ModelImporter:
rigImportWarnings:
animationImportErrors:
animationImportWarnings: "\nClip 'Take 001' has import animation warnings that
might lower retargeting quality:\nNote: Activate translation DOF on avatar to
improve retargeting quality.\n\t'B_Spine' has translation animation that will
be discarded.\n"
might lower retargeting quality:\nNote: Activate translation DOF on avatar
to improve retargeting quality.\n\t'B_Spine' has translation animation that
will be discarded.\n"
animationRetargetingWarnings:
animationDoRetargetingWarnings: 0
importAnimatedCustomProperties: 0
......@@ -521,7 +521,7 @@ ModelImporter:
keepOriginalPositionXZ: 1
heightFromFeet: 0
mirror: 0
bodyMask: 01000000010000000100000001000000010000000100000001000000010000000100000001000000010000000100000001000000
bodyMask: 01000000010000000100000001000000010000000000000001000000000000000100000001000000010000000000000001000000
curves: []
events:
- time: 0.2094763
......@@ -657,15 +657,18 @@ ModelImporter:
meshCompression: 0
addColliders: 0
useSRGBMaterialColor: 1
sortHierarchyByName: 1
importVisibility: 0
importBlendShapes: 0
importCameras: 0
importLights: 0
fileIdsGeneration: 1
swapUVChannels: 0
generateSecondaryUV: 0
useFileUnits: 1
keepQuads: 0
weldVertices: 0
bakeAxisConversion: 0
preserveHierarchy: 0
skinWeightsMode: 0
maxBonesPerVertex: 4
......@@ -675,6 +678,9 @@ ModelImporter:
secondaryUVAngleDistortion: 8
secondaryUVAreaDistortion: 15.000001
secondaryUVHardAngle: 88
secondaryUVMarginMethod: 0
secondaryUVMinLightmapResolution: 40
secondaryUVMinObjectScale: 1
secondaryUVPackMargin: 4
useFileScale: 0
tangentSpace:
......@@ -687,7 +693,6 @@ ModelImporter:
normalSmoothingSource: 0
referencedClips: []
importAnimation: 1
copyAvatar: 1
humanDescription:
serializedVersion: 3
human:
......@@ -1396,8 +1401,11 @@ ModelImporter:
skeletonHasParents: 0
lastHumanDescriptionAvatarSource: {fileID: 9000000, guid: e3942fec22e99384e9cee5aef64adec1,
type: 3}
autoGenerateAvatarMappingIfUnspecified: 1
animationType: 3
humanoidOversampling: 1
avatarSetup: 2
addHumanoidExtraRootOnlyWhenUsingAvatar: 0
additionalBone: 0
userData:
assetBundleName:
......
......@@ -38,7 +38,7 @@ ModelImporter:
name: Sword and Shield attack
takeName: mixamo.com
internalID: 0
firstFrame: 4.1
firstFrame: 4
lastFrame: 39
wrapMode: 0
orientationOffsetY: 0
......@@ -52,9 +52,9 @@ ModelImporter:
loopBlendPositionY: 1
loopBlendPositionXZ: 0
keepOriginalOrientation: 1
keepOriginalPositionY: 1
keepOriginalPositionY: 0
keepOriginalPositionXZ: 1
heightFromFeet: 0
heightFromFeet: 1
mirror: 0
bodyMask: 01000000010000000100000001000000010000000100000001000000010000000100000001000000010000000100000001000000
curves: []
......
......@@ -459,7 +459,7 @@ BlendTree:
m_Name: Blend Tree
m_Childs:
- serializedVersion: 2
m_Motion: {fileID: 7400000, guid: 8a646e73f32d5ab46be5ca7d3ebb4f3d, type: 3}
m_Motion: {fileID: 7400000, guid: f2c1d48120ff49c419050488b5fdfe8d, type: 3}
m_Threshold: 0
m_Position: {x: 0, y: 0}
m_TimeScale: 1
......@@ -467,15 +467,15 @@ BlendTree:
m_DirectBlendParameter: Blend
m_Mirror: 0
- serializedVersion: 2
m_Motion: {fileID: 7400000, guid: 0f5f811a33031524680b227a45dc9848, type: 3}
m_Threshold: 0.5
m_Motion: {fileID: 7400000, guid: 5d8ee6a4cdbcb0042a50ca001e7c45bf, type: 3}
m_Threshold: 0.1
m_Position: {x: -0.05, y: 0}
m_TimeScale: 1
m_CycleOffset: 0
m_DirectBlendParameter: Blend
m_Mirror: 0
- serializedVersion: 2
m_Motion: {fileID: 7400000, guid: 92e13e67a26415646a752312d3ac0230, type: 3}
m_Motion: {fileID: 7400000, guid: b093e573ca387a1459010ed43a16d2ad, type: 3}
m_Threshold: 1
m_Position: {x: 1, y: 0}
m_TimeScale: 1
......@@ -486,7 +486,7 @@ BlendTree:
m_BlendParameterY: turnRotation
m_MinThreshold: 0
m_MaxThreshold: 1
m_UseAutomaticThresholds: 1
m_UseAutomaticThresholds: 0
m_NormalizedBlendValues: 0
m_BlendType: 0
--- !u!1101 &4652188237738339612
......
......@@ -465,7 +465,7 @@ BlendTree:
m_Mirror: 0
- serializedVersion: 2
m_Motion: {fileID: 7400000, guid: 73343089e4172784b94f00a97fb84f21, type: 3}
m_Threshold: 0.5
m_Threshold: 0.1
m_Position: {x: -0.05, y: 0}
m_TimeScale: 1
m_CycleOffset: 0
......@@ -483,7 +483,7 @@ BlendTree:
m_BlendParameterY: turnRotation
m_MinThreshold: 0
m_MaxThreshold: 1
m_UseAutomaticThresholds: 1
m_UseAutomaticThresholds: 0
m_NormalizedBlendValues: 0
m_BlendType: 0
--- !u!1101 &4652188237738339612
......
......@@ -86,7 +86,7 @@ AnimatorState:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Use Ability 1
m_Speed: 1
m_Speed: 1.5
m_CycleOffset: 0
m_Transitions:
- {fileID: 4652188237738339612}
......@@ -457,7 +457,7 @@ BlendTree:
m_Name: Blend Tree
m_Childs:
- serializedVersion: 2
m_Motion: {fileID: 7400002, guid: 6b2b46c8d4f633847a492f1a7b497230, type: 3}
m_Motion: {fileID: 7400000, guid: 8a646e73f32d5ab46be5ca7d3ebb4f3d, type: 3}
m_Threshold: 0
m_Position: {x: 0, y: 0}
m_TimeScale: 1
......@@ -465,8 +465,8 @@ BlendTree:
m_DirectBlendParameter: Blend
m_Mirror: 0
- serializedVersion: 2
m_Motion: {fileID: 7400000, guid: 5ea35b5cb8b89104c83156dcde845d31, type: 3}
m_Threshold: 0.5
m_Motion: {fileID: 7400000, guid: 0f5f811a33031524680b227a45dc9848, type: 3}
m_Threshold: 0.1
m_Position: {x: -0.05, y: 0}
m_TimeScale: 1
m_CycleOffset: 0
......@@ -477,14 +477,14 @@ BlendTree:
m_Threshold: 1
m_Position: {x: 1, y: 0}
m_TimeScale: 1
m_CycleOffset: 0
m_CycleOffset: 0.5
m_DirectBlendParameter: Blend
m_Mirror: 0
m_Mirror: 1
m_BlendParameter: speedPercent
m_BlendParameterY: turnRotation
m_MinThreshold: 0
m_MaxThreshold: 1
m_UseAutomaticThresholds: 1
m_UseAutomaticThresholds: 0
m_NormalizedBlendValues: 0
m_BlendType: 0
--- !u!1101 &4652188237738339612
......
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 12146, guid: 0000000000000000e000000000000000, type: 0}
m_Name: NewBrush
m_EditorClassIdentifier:
m_Mask: {fileID: 2800000, guid: 2c528fec5d95e4ac28cf46399b887662, type: 3}
m_Falloff:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 1
tangentMode: 0
weightedMode: 0
inWeight: 0
outWeight: 0
- serializedVersion: 3
time: 1
value: 1
inSlope: 1
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0
outWeight: 0
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
m_RadiusScale: 1.4849247
m_BlackWhiteRemapMin: 0
m_BlackWhiteRemapMax: 1
m_InvertRemapRange: 0
fileFormatVersion: 2
guid: ef1b9ff7f493c2e4b9d2769ef2434ba8
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 8574412962073106934
userData:
assetBundleName:
assetBundleVariant:
This diff is collapsed. Click to expand it.
......@@ -128,7 +128,8 @@ public class Aoe_Ability : Ability
private void CheckLine()
{
Ray aoeLineRay = new Ray(abilityUser.transform.position, abilityUser.transform.TransformDirection(Vector3.forward) * 2);
RaycastHit[] collidersHit = Physics.RaycastAll(aoeLineRay, areaSize);
RaycastHit[] collidersHit = Physics.SphereCastAll(aoeLineRay, 0.3f, areaSize);
if (collidersHit != null)
{
......
fileFormatVersion: 2
guid: c0522a1bc1d63f14ca2a5aba016c7f99
guid: 71ac70fe27475864bb884441ab503c7b
folderAsset: yes
DefaultImporter:
externalObjects: {}
......
......@@ -20,6 +20,7 @@ public class CharacterAnimator : MonoBehaviour
float speedPercent = 0;
if (agent.speed > 0)
speedPercent = agent.velocity.magnitude / agent.speed;
//characterAnim.SetFloat("speedPercent", speedPercent, locoAnimSmoothTime, Time.deltaTime);
characterAnim.SetFloat("speedPercent", speedPercent, locoAnimSmoothTime, Time.deltaTime);
}
}
......
......@@ -86,7 +86,6 @@ public class CharacterCombat : MonoBehaviour
//InCombat = true;
lastAttackTime = Time.time;
}
}
......@@ -299,11 +298,11 @@ public class CharacterCombat : MonoBehaviour
private void OnDrawGizmos()
{
Gizmos.color = Color.red;
Gizmos.color = Color.yellow;
//Gizmos.DrawWireCube(transform.position, new Vector3(6,6,6));
//if(attackRange > 0)
//Gizmos.DrawWireSphere(transform.position, attackRange);
if(attackRange > 0)
Gizmos.DrawWireSphere(transform.position, attackRange);
}
}
......
using UnityEngine;
using System.Collections.Generic;
using UnityEngine;
public class Enemy : Interactable
{
Character_Stats myStats;
CharacterCombat interactorCombat;
List<CharacterCombat> interactorCombats = new List<CharacterCombat>();
private void Start()
{
......@@ -12,12 +13,33 @@ public class Enemy : Interactable
public override void Interact(GameObject interactor)
{
base.Interact(interactor);
if (interactor.TryGetComponent(out CharacterCombat attackerCombat))
{
attackerCombat.Attack(myStats);
}
}
void CheckDistance(float distance, CharacterCombat attackerCombat)
{
if (attackerCombat.attackRange > 0)
{
if (distance <= attackerCombat.attackRange)
{
Interact(attackerCombat.gameObject);
}
else if (distance > attackerCombat.attackRange)
attackerCombat.GetComponent<CharacterAnimator>().characterAnim.SetBool("basicAttack", false);
}
interactorCombat = interactor.GetComponent<CharacterCombat>();
if (interactorCombat != null)
else
{
interactorCombat.Attack(myStats);
if (distance <= radius)
{
Interact(attackerCombat.gameObject);
}
else if (distance > radius)
attackerCombat.GetComponent<CharacterAnimator>().characterAnim.SetBool("basicAttack", false);
}
}
......@@ -25,74 +47,50 @@ public class Enemy : Interactable
{
//If this interactable is the focus of a character and not interacted with yet
//check if character is close enough to interact, if so, set hasInteracted to true
if (isFocus)
for (int i = 0; i < interactorCombats.Count; i++)
{
if (myStats.dead)
if (isFocus)
{
interactorCombat.GetComponent<CharacterAnimator>().characterAnim.SetBool("basicAttack", false);
interactor.GetComponent<Player_Controller>().RemoveFocus();
GetComponent<Enemy>().enabled = false;
return;
float distance = Vector3.Distance(interactorCombats[i].transform.position, interactionTransform.position);
CheckDistance(distance, interactorCombats[i]);
}
if (!hasInteracted)
if (myStats.dead)
{
float distance = Vector3.Distance(interactor.position, interactionTransform.position);
if (interactor.GetComponent<CharacterCombat>().attackRange > 0)
{
if (distance <= interactor.GetComponent<CharacterCombat>().attackRange)
{
Interact(interactor.gameObject);
hasInteracted = true;
}
}
else
{
if (distance <= radius)
{
Interact(interactor.gameObject);
hasInteracted = true;
}
}
interactorCombats[i].GetComponent<Player_Controller>().RemoveFocus();
return;
}
}
//if the enemy has been attacked, then continue attacking as long they're still focused
//and their attack cooldown allows it
else if (hasInteracted && interactorCombat.GetAttackCooldown() <= 0)
{
float distance = Vector3.Distance(interactor.position, interactionTransform.position);
if (interactor.GetComponent<CharacterCombat>().attackRange > 0)
{
if (distance <= interactor.GetComponent<CharacterCombat>().attackRange)
{
Interact(interactor.gameObject);
}
if(distance > interactor.GetComponent<CharacterCombat>().attackRange)
interactorCombat.GetComponent<CharacterAnimator>().characterAnim.SetBool("basicAttack", false);
}
else
{
if (distance <= radius)
{
Interact(interactor.gameObject);
}
if (distance > radius)
interactorCombat.GetComponent<CharacterAnimator>().characterAnim.SetBool("basicAttack", false);
}
}
if (myStats.dead && interactorCombats.Count == 0)
{
GetComponent<Enemy>().enabled = false;
}
else
}
public override void OnDefocused(GameObject interactor)
{
base.OnDefocused(interactor);
for (int i = 0; i < interactorCombats.Count; i++)
{
if (interactorCombat != null)
if (interactor.TryGetComponent(out CharacterCombat attackerCombat))
{
interactorCombat.GetComponent<CharacterAnimator>().characterAnim.SetBool("basicAttack", false);
interactorCombat = null;
attackerCombat.GetComponent<CharacterAnimator>().characterAnim.SetBool("basicAttack", false);
interactorCombats.Remove(attackerCombat);
}
}
}
public override void OnFocused(Transform interactorTransform)
{
base.OnFocused(interactorTransform);
if(interactorTransform.TryGetComponent(out CharacterCombat attackerCombat))
interactorCombats.Add(attackerCombat);
}
......
......@@ -6,7 +6,7 @@ public class Interactable : MonoBehaviour
public Transform interactionTransform;
protected bool isFocus = false;
protected Transform interactor;
protected Transform interactorCharacter;
protected bool hasInteracted = false;
......@@ -24,29 +24,28 @@ public class Interactable : MonoBehaviour
//check if character is close enough to interact, if so, set hasInteracted to true
if (isFocus && !hasInteracted)
{
float distance = Vector3.Distance(interactor.position, interactionTransform.position);
float distance = Vector3.Distance(interactorCharacter.position, interactionTransform.position);
if (distance <= radius)
{
Interact(interactor.gameObject);
Interact(interactorCharacter.gameObject);
hasInteracted = true;
}
}
}
//Once this interactable has been focused, finds out who is focusing it
public void OnFocused(Transform interactorTransform)
public virtual void OnFocused(Transform interactorTransform)
{
isFocus = true;
interactor = interactorTransform;
interactorCharacter = interactorTransform;
hasInteracted = false;
}
//If interactable is no longer being focused, resets variables
public void OnDefocused()
public virtual void OnDefocused(GameObject defocuser)
{
isFocus = false;
interactor = null;
interactorCharacter = null;
hasInteracted = false;
}
......
fileFormatVersion: 2
guid: e96eeefe565c9a24989b03e5fab99805
NativeFormatImporter:
guid: 0637407c6f2e1ef42a37283a59a4bbe8
folderAsset: yes
DefaultImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:
......
......@@ -40,12 +40,16 @@ public class Player_Controller : MonoBehaviour
// Update is called once per frame
void Update()
{
if (activeCharacter == false && focus == null)
if (activeCharacter == false)
{
movement.FollowTarget(playerManager.activePerson.gameObject, 3);
anim.characterAnim.SetBool("basicAttack", false);
if (focus == null)
{
movement.FollowTarget(playerManager.activePerson.gameObject, 5);
anim.characterAnim.SetBool("basicAttack", false);
}
return;
}
......@@ -78,8 +82,8 @@ public class Player_Controller : MonoBehaviour
if (Physics.Raycast(ray, out hit, 100))
{
Interactable interactable = hit.collider.GetComponent<Interactable>();
if (interactable != null)
//Interactable interactable = hit.collider.GetComponent<Interactable>();
if (hit.collider.TryGetComponent(out Interactable interactable))
{
SetFocus(interactable);
}
......@@ -94,7 +98,7 @@ public class Player_Controller : MonoBehaviour
if (newFocus != focus)
{
if (focus != null)
focus.OnDefocused();
focus.OnDefocused(gameObject);
focus = newFocus;
......@@ -110,7 +114,7 @@ public class Player_Controller : MonoBehaviour
public void RemoveFocus()
{
if (focus != null)
focus.OnDefocused();
focus.OnDefocused(gameObject);
focus = null;
movement.StopFollowTarget();
......
......@@ -39,8 +39,7 @@ public class Player_Movement : MonoBehaviour
if (combat.cc_Effects.Count == 0)
{
agent.SetDestination(target.position);
agent.acceleration = 12f;
agent.angularSpeed = 120f;
//agent.angularSpeed = 100f;
}
else
......@@ -50,8 +49,7 @@ public class Player_Movement : MonoBehaviour
if (effect.affect != StatusEffects.Root)
{
agent.SetDestination(target.position);
agent.acceleration = 12f;
agent.angularSpeed = 120f;
//agent.angularSpeed = 120f;
}
}
}
......@@ -71,7 +69,7 @@ public class Player_Movement : MonoBehaviour
public void MovetoPoint(Vector3 newPoint)
{
agent.stoppingDistance = 0.2f;
agent.stoppingDistance = 2.0f;
agent.SetDestination(newPoint);
if(combat.GetAttackCooldown() > 0)
combat.SetAttackCooldown(0.0f);
......@@ -80,6 +78,11 @@ public class Player_Movement : MonoBehaviour
public void FollowTarget(Interactable newTarget)
{
agent.stoppingDistance = newTarget.radius;
if (combat.attackRange > 0 && newTarget.TryGetComponent(out Enemy enemyInteractable))
agent.stoppingDistance = combat.attackRange - 0.1f;
agent.updateRotation = false;
target = newTarget.interactionTransform;
if (combat.GetAttackCooldown() > 0)
......@@ -88,7 +91,7 @@ public class Player_Movement : MonoBehaviour
public void FollowTarget(GameObject newTarget, float stopDistance)
{
agent.stoppingDistance = stopDistance * 0.9f;
agent.stoppingDistance = stopDistance;
target = newTarget.transform;
}
......
......@@ -6,7 +6,7 @@ TerrainLayer:
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: NewLayer 1
m_Name: Dirt Layer
m_DiffuseTexture: {fileID: 2800000, guid: 440eb36db91ca410f800ff3cfe43572f, type: 3}
m_NormalMapTexture: {fileID: 0}
m_MaskMapTexture: {fileID: 0}
......
......@@ -6,7 +6,7 @@ TerrainLayer:
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: NewLayer
m_Name: Grass Layer
m_DiffuseTexture: {fileID: 2800000, guid: c6e0767b1f8c34890ac245217f4b9731, type: 3}
m_NormalMapTexture: {fileID: 0}
m_MaskMapTexture: {fileID: 0}
......
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1953259897 &8574412962073106934
TerrainLayer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: NewLayer 2
m_DiffuseTexture: {fileID: 2800000, guid: 18214e9d6af6248559d501391856f1c7, type: 3}
m_NormalMapTexture: {fileID: 0}
m_MaskMapTexture: {fileID: 0}
m_TileSize: {x: 2, y: 2}
m_TileOffset: {x: 0, y: 0}
m_Specular: {r: 0, g: 0, b: 0, a: 0}
m_Metallic: 0
m_Smoothness: 0
m_NormalScale: 1
m_DiffuseRemapMin: {x: 0, y: 0, z: 0, w: 0}
m_DiffuseRemapMax: {x: 1, y: 1, z: 1, w: 1}
m_MaskMapRemapMin: {x: 0, y: 0, z: 0, w: 0}
m_MaskMapRemapMax: {x: 1, y: 1, z: 1, w: 1}
......@@ -6,7 +6,7 @@ TerrainLayer:
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: NewLayer
m_Name: Rock Layer
m_DiffuseTexture: {fileID: 2800000, guid: 18214e9d6af6248559d501391856f1c7, type: 3}
m_NormalMapTexture: {fileID: 0}
m_MaskMapTexture: {fileID: 0}
......
......@@ -18,7 +18,7 @@ MonoBehaviour:
cc_Effects: []
projectile: {fileID: 0}
delay: 1.2
range: 1.5
range: 3
displacement:
pushOrPull: 0
distance: 2
......@@ -31,8 +31,8 @@ MonoBehaviour:
spawnParticleEffect: {fileID: 1040608886635896, guid: a97415c6b57076f41a6621a7b51d63a3,
type: 3}
castTime: 2.15
cooldownTimer: 15.7691765
areaSize: 1
cooldownTimer: -12.094551
areaSize: 2
aoeType: 0
selfOrigin: 0
targets: []
......
......@@ -18,9 +18,9 @@ MonoBehaviour:
cc_Effects:
- affect: 1
duration: 2
durationTimer: -0.02344603
durationTimer: 2
projectile: {fileID: 0}
delay: 0.2
delay: 0.6
range: 10
displacement:
pushOrPull: 0
......@@ -32,9 +32,9 @@ MonoBehaviour:
targetType: 2
animatorTrigger: ability1
spawnParticleEffect: {fileID: 0}
castTime: 2.75
cooldownTimer: -20.370638
areaSize: 1000
castTime: 1.5
cooldownTimer: 0.73232627
areaSize: 10
aoeType: 3
selfOrigin: 0
targets: []
......
......@@ -18,7 +18,7 @@ MonoBehaviour:
cc_Effects:
- affect: 0
duration: 3
durationTimer: -0.16507462
durationTimer: 3
projectile: {fileID: 0}
delay: 1.13
range: 0
......@@ -31,9 +31,10 @@ MonoBehaviour:
cooldown: 12
targetType: 2
animatorTrigger: ability2
spawnParticleEffect: {fileID: 0}
castTime: 2.2
cooldownTimer: -31.10422
areaSize: 3
cooldownTimer: -15.333064
areaSize: 5
aoeType: 0
selfOrigin: 1
targets: []
......
......@@ -18,7 +18,7 @@ MonoBehaviour:
cc_Effects: []
projectile: {fileID: 0}
delay: 0.5
range: 7
range: 10
displacement:
pushOrPull: 1
distance: 2
......@@ -31,7 +31,7 @@ MonoBehaviour:
spawnParticleEffect: {fileID: 2171030861177555596, guid: 6aaa619d928720c4887a82c1883b9c6a,
type: 3}
castTime: 1.35
cooldownTimer: 3.5685046
cooldownTimer: -15.333064
areaSize: 4
aoeType: 1
selfOrigin: 0
......
......@@ -33,9 +33,10 @@ MonoBehaviour:
cooldown: 10
targetType: 1
animatorTrigger: ability3
spawnParticleEffect: {fileID: 0}
castTime: 3
cooldownTimer: -31.10422
areaSize: 2
cooldownTimer: -12.094551
areaSize: 4
aoeType: 1
selfOrigin: 1
targets: []
......
......@@ -18,7 +18,7 @@ MonoBehaviour:
- amount: 10
affects: 0
duration: 6
durationTimer: 1.8188334
durationTimer: 6
ramping: 0
cc_Effects: []
projectile: {fileID: 0}
......@@ -33,9 +33,10 @@ MonoBehaviour:
cooldown: 7
targetType: 1
animatorTrigger: ability2
spawnParticleEffect: {fileID: 0}
castTime: 2.37
cooldownTimer: -31.10422
areaSize: 3
cooldownTimer: -12.094551
areaSize: 4
aoeType: 0
selfOrigin: 1
targets: []
......