Commit c5f154dc authored by 15박보승's avatar 15박보승

훅 움직임 개선/맵 밖으로 나가고 10초가 지날시 패배가 되도록 구현

parent d26f8bbc
...@@ -111,7 +111,7 @@ MonoBehaviour: ...@@ -111,7 +111,7 @@ MonoBehaviour:
curHealth: 0 curHealth: 0
attackDamage: 5 attackDamage: 5
detectRange: 0 detectRange: 0
moveSpeed: 0.5 moveSpeed: 20
playerMask: playerMask:
serializedVersion: 2 serializedVersion: 2
m_Bits: 256 m_Bits: 256
...@@ -119,6 +119,7 @@ MonoBehaviour: ...@@ -119,6 +119,7 @@ MonoBehaviour:
bloodEffect: {fileID: 0} bloodEffect: {fileID: 0}
shotSpeed: 0 shotSpeed: 0
shotTimeInterval: 0 shotTimeInterval: 0
rb: {fileID: 0}
--- !u!54 &13760249356785958 --- !u!54 &13760249356785958
Rigidbody: Rigidbody:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
......
...@@ -154,7 +154,7 @@ Transform: ...@@ -154,7 +154,7 @@ Transform:
m_LocalScale: {x: 0.1, y: 0.1, z: 0.1} m_LocalScale: {x: 0.1, y: 0.1, z: 0.1}
m_Children: [] m_Children: []
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 4 m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!135 &48712144 --- !u!135 &48712144
SphereCollider: SphereCollider:
...@@ -502,7 +502,7 @@ PrefabInstance: ...@@ -502,7 +502,7 @@ PrefabInstance:
- target: {fileID: 808483076966640907, guid: 60f985c4e15827746af49ee480a2d6f9, - target: {fileID: 808483076966640907, guid: 60f985c4e15827746af49ee480a2d6f9,
type: 3} type: 3}
propertyPath: m_RootOrder propertyPath: m_RootOrder
value: 14 value: 13
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 808483076966640907, guid: 60f985c4e15827746af49ee480a2d6f9, - target: {fileID: 808483076966640907, guid: 60f985c4e15827746af49ee480a2d6f9,
type: 3} type: 3}
...@@ -558,8 +558,9 @@ Transform: ...@@ -558,8 +558,9 @@ Transform:
- {fileID: 60348337} - {fileID: 60348337}
- {fileID: 245057451} - {fileID: 245057451}
- {fileID: 1077217540} - {fileID: 1077217540}
- {fileID: 825443685}
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 10 m_RootOrder: 9
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &235153516 --- !u!114 &235153516
MonoBehaviour: MonoBehaviour:
...@@ -1014,7 +1015,7 @@ RectTransform: ...@@ -1014,7 +1015,7 @@ RectTransform:
- {fileID: 274921780} - {fileID: 274921780}
- {fileID: 1972759491} - {fileID: 1972759491}
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 7 m_RootOrder: 6
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0} m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0}
...@@ -1199,7 +1200,7 @@ PrefabInstance: ...@@ -1199,7 +1200,7 @@ PrefabInstance:
- target: {fileID: 808483076966640907, guid: 60f985c4e15827746af49ee480a2d6f9, - target: {fileID: 808483076966640907, guid: 60f985c4e15827746af49ee480a2d6f9,
type: 3} type: 3}
propertyPath: m_RootOrder propertyPath: m_RootOrder
value: 15 value: 14
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 808483076966640907, guid: 60f985c4e15827746af49ee480a2d6f9, - target: {fileID: 808483076966640907, guid: 60f985c4e15827746af49ee480a2d6f9,
type: 3} type: 3}
...@@ -1395,12 +1396,12 @@ Transform: ...@@ -1395,12 +1396,12 @@ Transform:
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 825443681} m_GameObject: {fileID: 825443681}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 50, z: 19} m_LocalPosition: {x: 0, y: 50, z: 19}
m_LocalScale: {x: 20, y: 10, z: 20} m_LocalScale: {x: 20, y: 10, z: 20}
m_Children: [] m_Children: []
m_Father: {fileID: 0} m_Father: {fileID: 235153515}
m_RootOrder: 2 m_RootOrder: 9
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!54 &825443686 --- !u!54 &825443686
Rigidbody: Rigidbody:
...@@ -1599,7 +1600,7 @@ Transform: ...@@ -1599,7 +1600,7 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: [] m_Children: []
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 5 m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 30, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 30, y: 0, z: 0}
--- !u!114 &963194229 --- !u!114 &963194229
MonoBehaviour: MonoBehaviour:
...@@ -1851,7 +1852,7 @@ Transform: ...@@ -1851,7 +1852,7 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: [] m_Children: []
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 9 m_RootOrder: 8
m_LocalEulerAnglesHint: {x: -90, y: 0, z: 0} m_LocalEulerAnglesHint: {x: -90, y: 0, z: 0}
--- !u!199 &1086498342 --- !u!199 &1086498342
ParticleSystemRenderer: ParticleSystemRenderer:
...@@ -2749,7 +2750,7 @@ ParticleSystem: ...@@ -2749,7 +2750,7 @@ ParticleSystem:
rateOverTime: rateOverTime:
serializedVersion: 2 serializedVersion: 2
minMaxState: 0 minMaxState: 0
scalar: 50 scalar: 10
minScalar: 10 minScalar: 10
maxCurve: maxCurve:
serializedVersion: 2 serializedVersion: 2
...@@ -6636,7 +6637,7 @@ PrefabInstance: ...@@ -6636,7 +6637,7 @@ PrefabInstance:
- target: {fileID: 808483076966640907, guid: 60f985c4e15827746af49ee480a2d6f9, - target: {fileID: 808483076966640907, guid: 60f985c4e15827746af49ee480a2d6f9,
type: 3} type: 3}
propertyPath: m_RootOrder propertyPath: m_RootOrder
value: 11 value: 10
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 808483076966640907, guid: 60f985c4e15827746af49ee480a2d6f9, - target: {fileID: 808483076966640907, guid: 60f985c4e15827746af49ee480a2d6f9,
type: 3} type: 3}
...@@ -6671,6 +6672,7 @@ GameObject: ...@@ -6671,6 +6672,7 @@ GameObject:
- component: {fileID: 1171556385} - component: {fileID: 1171556385}
- component: {fileID: 1171556383} - component: {fileID: 1171556383}
- component: {fileID: 1171556390} - component: {fileID: 1171556390}
- component: {fileID: 1171556391}
m_Layer: 8 m_Layer: 8
m_Name: Player m_Name: Player
m_TagString: Untagged m_TagString: Untagged
...@@ -6709,6 +6711,8 @@ MonoBehaviour: ...@@ -6709,6 +6711,8 @@ MonoBehaviour:
ConnectedRigidbody: {fileID: 48712147} ConnectedRigidbody: {fileID: 48712147}
distance: 0 distance: 0
damper: 0 damper: 0
moveDelta: {x: 0, y: 0, z: 0}
ps: 20
--- !u!143 &1171556385 --- !u!143 &1171556385
CharacterController: CharacterController:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
...@@ -6787,7 +6791,7 @@ Transform: ...@@ -6787,7 +6791,7 @@ Transform:
- {fileID: 887314839} - {fileID: 887314839}
- {fileID: 1266258514} - {fileID: 1266258514}
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 3 m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1171556389 --- !u!114 &1171556389
MonoBehaviour: MonoBehaviour:
...@@ -6807,18 +6811,6 @@ MonoBehaviour: ...@@ -6807,18 +6811,6 @@ MonoBehaviour:
groundMask: groundMask:
serializedVersion: 2 serializedVersion: 2
m_Bits: 1 m_Bits: 1
knifeDamage: 50
gunDamage: 1
gunRange: 50
bulletEffect: {fileID: 1266258516}
knifeRange: 3
knifeEffect: {fileID: 0}
enemyMask:
serializedVersion: 2
m_Bits: 1024
blockMask:
serializedVersion: 2
m_Bits: 55
--- !u!136 &1171556390 --- !u!136 &1171556390
CapsuleCollider: CapsuleCollider:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
...@@ -6833,6 +6825,30 @@ CapsuleCollider: ...@@ -6833,6 +6825,30 @@ CapsuleCollider:
m_Height: 2 m_Height: 2
m_Direction: 1 m_Direction: 1
m_Center: {x: 0, y: 0, z: 0} m_Center: {x: 0, y: 0, z: 0}
--- !u!114 &1171556391
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1171556382}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d8563877a588e844da7d4f831005a6b4, type: 3}
m_Name:
m_EditorClassIdentifier:
knifeDamage: 50
gunDamage: 1
gunRange: 50
bulletEffect: {fileID: 1266258516}
knifeRange: 10
knifeEffect: {fileID: 0}
enemyMask:
serializedVersion: 2
m_Bits: 1024
blockMask:
serializedVersion: 2
m_Bits: 55
--- !u!1 &1266258513 --- !u!1 &1266258513
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
...@@ -11759,7 +11775,7 @@ Transform: ...@@ -11759,7 +11775,7 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: [] m_Children: []
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 8 m_RootOrder: 7
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1001 &1457301417 --- !u!1001 &1457301417
PrefabInstance: PrefabInstance:
...@@ -11811,7 +11827,7 @@ PrefabInstance: ...@@ -11811,7 +11827,7 @@ PrefabInstance:
- target: {fileID: 808483076966640907, guid: 60f985c4e15827746af49ee480a2d6f9, - target: {fileID: 808483076966640907, guid: 60f985c4e15827746af49ee480a2d6f9,
type: 3} type: 3}
propertyPath: m_RootOrder propertyPath: m_RootOrder
value: 13 value: 12
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 808483076966640907, guid: 60f985c4e15827746af49ee480a2d6f9, - target: {fileID: 808483076966640907, guid: 60f985c4e15827746af49ee480a2d6f9,
type: 3} type: 3}
...@@ -12094,7 +12110,7 @@ Transform: ...@@ -12094,7 +12110,7 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: [] m_Children: []
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 6 m_RootOrder: 5
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1873763589 --- !u!1 &1873763589
GameObject: GameObject:
...@@ -12257,7 +12273,7 @@ PrefabInstance: ...@@ -12257,7 +12273,7 @@ PrefabInstance:
- target: {fileID: 808483076966640907, guid: 60f985c4e15827746af49ee480a2d6f9, - target: {fileID: 808483076966640907, guid: 60f985c4e15827746af49ee480a2d6f9,
type: 3} type: 3}
propertyPath: m_RootOrder propertyPath: m_RootOrder
value: 12 value: 11
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 808483076966640907, guid: 60f985c4e15827746af49ee480a2d6f9, - target: {fileID: 808483076966640907, guid: 60f985c4e15827746af49ee480a2d6f9,
type: 3} type: 3}
......
...@@ -8,8 +8,13 @@ public class DistanceJoint3D : MonoBehaviour ...@@ -8,8 +8,13 @@ public class DistanceJoint3D : MonoBehaviour
public float distance; public float distance;
public float damper = 5f; public float damper = 5f;
public Vector3 moveDelta;
private Rigidbody rb; private Rigidbody rb;
[SerializeField]
private float ps= 10;
private void Awake() private void Awake()
{ {
rb = GetComponent<Rigidbody>(); rb = GetComponent<Rigidbody>();
...@@ -24,8 +29,8 @@ public class DistanceJoint3D : MonoBehaviour ...@@ -24,8 +29,8 @@ public class DistanceJoint3D : MonoBehaviour
{ {
if (distance > 0) if (distance > 0)
{ {
distance = Mathf.Max(0, distance - 100 * Time.deltaTime); distance = Mathf.Max(0, distance - ps * Time.deltaTime);
//distance = Mathf.Lerp(distance, 0, 0.8f); //distance = Mathf.Lerp(distance, 0, 0.1f);
} }
} }
private void FixedUpdate() private void FixedUpdate()
...@@ -34,11 +39,31 @@ public class DistanceJoint3D : MonoBehaviour ...@@ -34,11 +39,31 @@ public class DistanceJoint3D : MonoBehaviour
var connection = rb.position - ConnectedRigidbody.position; var connection = rb.position - ConnectedRigidbody.position;
var distanceDiscrepancy = distance - connection.magnitude; var distanceDiscrepancy = distance - connection.magnitude;
//rb.position += distanceDiscrepancy * connection.normalized; //rb.position += distanceDiscrepancy * connection.normalized;
rb.AddForce(-connection, ForceMode.Acceleration);
var velocityTarget = connection + rb.velocity; var velocityTarget = connection + rb.velocity;
var projectOnConnect = Vector3.Project(velocityTarget, connection); var projectOnConnect = Vector3.Project(velocityTarget, connection);
rb.velocity = (velocityTarget - projectOnConnect + distanceDiscrepancy * connection.normalized) / (1 + damper * Time.fixedDeltaTime); rb.velocity = (velocityTarget - projectOnConnect + /*distanceDiscrepancy */ -ps * connection.normalized + (projectOnConnect - connection) * 0.1f) / (1 + damper * Time.fixedDeltaTime);
} rb.AddForce(moveDelta);
//rb.position += distanceDiscrepancy * connection.normalized;
/*
float distanceDelta = Vector3.Dot(rb.velocity, connection.normalized);
Debug.Log(distanceDelta);
if (distanceDelta > 0)
{
distance += distanceDelta;
rb.velocity -= connection.normalized;
}
else
{
var velocityTarget = connection + rb.velocity;
var projectOnConnect = Vector3.Project(velocityTarget, connection);
rb.velocity = (velocityTarget - projectOnConnect + distanceDiscrepancy * connection.normalized) / (1 + damper * Time.fixedDeltaTime);
}
*/
}
} }
...@@ -3,6 +3,7 @@ using System.Collections.Generic; ...@@ -3,6 +3,7 @@ using System.Collections.Generic;
using UnityEngine; using UnityEngine;
using UnityEngine.UI; using UnityEngine.UI;
[RequireComponent(typeof(Rigidbody))]
public abstract class Enemy : MonoBehaviour public abstract class Enemy : MonoBehaviour
{ {
[SerializeField] [SerializeField]
...@@ -38,6 +39,9 @@ public abstract class Enemy : MonoBehaviour ...@@ -38,6 +39,9 @@ public abstract class Enemy : MonoBehaviour
private float shotTimeInterval; private float shotTimeInterval;
private float shotTimer; private float shotTimer;
[SerializeField]
protected Rigidbody rb;
public bool IsDead { get { return curHealth <= 0; } } public bool IsDead { get { return curHealth <= 0; } }
#if UNITY_EDITOR #if UNITY_EDITOR
...@@ -51,6 +55,7 @@ public abstract class Enemy : MonoBehaviour ...@@ -51,6 +55,7 @@ public abstract class Enemy : MonoBehaviour
private void Start() private void Start()
{ {
col = GetComponent<Collider>(); col = GetComponent<Collider>();
rb = GetComponent<Rigidbody>();
curHealth = maxHealth; curHealth = maxHealth;
InitializeStateMachine(); InitializeStateMachine();
} }
......
...@@ -10,7 +10,7 @@ public class Missile : Enemy ...@@ -10,7 +10,7 @@ public class Missile : Enemy
idle.StateUpdate += delegate idle.StateUpdate += delegate
{ {
transform.position += (target.transform.position - transform.position).normalized * moveSpeed; rb.velocity = (target.transform.position - transform.position).normalized * moveSpeed;
}; };
stateMachine.AddNewState(idle); stateMachine.AddNewState(idle);
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
public class MapManager : MonoBehaviour public class MapManager : SingletonBehaviour<MapManager>
{ {
private float nextMapBlockGenerateDistance; private float nextMapBlockGenerateDistance;
private float nextEnemyGenerateDistance; private float nextEnemyGenerateDistance;
...@@ -23,10 +23,14 @@ public class MapManager : MonoBehaviour ...@@ -23,10 +23,14 @@ public class MapManager : MonoBehaviour
mapBound.center = new Vector3(0, height, 0); mapBound.center = new Vector3(0, height, 0);
foreach (Transform child in transform) foreach (Transform child in transform)
{ {
if (child.position.y < height - 500) if (child.position.y < height - mapBound.extents.y)
{ {
child.gameObject.SetActive(false); child.gameObject.SetActive(false);
} }
} }
} }
public bool IsOutOfMapBounds(Vector3 pos)
{
return !mapBound.Contains(pos);
}
} }
...@@ -43,7 +43,10 @@ public class PlayerController : MonoBehaviour ...@@ -43,7 +43,10 @@ public class PlayerController : MonoBehaviour
IngameUIManager.inst.UpdatePlayerHealthUI(MaxHealth, _health); IngameUIManager.inst.UpdatePlayerHealthUI(MaxHealth, _health);
} }
} }
[SerializeField]
private float outOfMapTimer = 10;
#if UNITY_EDITOR #if UNITY_EDITOR
private void OnDrawGizmos() private void OnDrawGizmos()
{ {
...@@ -91,8 +94,20 @@ public class PlayerController : MonoBehaviour ...@@ -91,8 +94,20 @@ public class PlayerController : MonoBehaviour
} }
else else
{ {
rb.AddForce(horizontal * transform.right + vertical * transform.forward * 10.0f); if (joint.enabled)
joint.moveDelta = (horizontal * transform.right + vertical * transform.forward).normalized * 30.0f;
else
rb.AddForce(horizontal * Camera.main.transform.right + vertical * Camera.main.transform.forward * 10.0f);
} }
if (MapManager.inst.IsOutOfMapBounds(transform.position))
{
outOfMapTimer -= Time.deltaTime;
if (outOfMapTimer <= 0)
Health = 0;
}
else
outOfMapTimer = 10;
} }
private void LateUpdate() private void LateUpdate()
...@@ -105,7 +120,7 @@ public class PlayerController : MonoBehaviour ...@@ -105,7 +120,7 @@ public class PlayerController : MonoBehaviour
} }
} }
private void FireHook() private void FireHook()
{ {
joint.enabled = false; joint.enabled = false;
hook.gameObject.SetActive(true); hook.gameObject.SetActive(true);
...@@ -118,7 +133,7 @@ public class PlayerController : MonoBehaviour ...@@ -118,7 +133,7 @@ public class PlayerController : MonoBehaviour
joint.enabled = false; joint.enabled = false;
hook.DisableHook(); hook.DisableHook();
isWired = false; isWired = false;
rb.useGravity = true; //rb.useGravity = true;
} }
public void ActiveWire() public void ActiveWire()
...@@ -126,7 +141,7 @@ public class PlayerController : MonoBehaviour ...@@ -126,7 +141,7 @@ public class PlayerController : MonoBehaviour
joint.enabled = true; joint.enabled = true;
joint.distance = Vector3.Distance(transform.position, hook.transform.position); joint.distance = Vector3.Distance(transform.position, hook.transform.position);
isWired = true; isWired = true;
rb.useGravity = false; //rb.useGravity = false;
} }
public void GetDamaged(int damage) public void GetDamaged(int damage)
......
...@@ -194,29 +194,33 @@ public class Knife : IWeapon ...@@ -194,29 +194,33 @@ public class Knife : IWeapon
private IEnumerator SkillRoutine() private IEnumerator SkillRoutine()
{ {
const float dashDistance = 50;
const float dashTime = 0.2f;
Vector3 oriPos = player.position; Vector3 oriPos = player.position;
Ray ray = new Ray(player.position, Camera.main.transform.forward); Ray ray = new Ray(player.position, Camera.main.transform.forward);
RaycastHit hit; RaycastHit hit;
Physics.Raycast(ray, out hit, 30, player.GetComponent<PlayerController>().groundMask); Physics.Raycast(ray, out hit, dashDistance, player.GetComponent<PlayerController>().groundMask);
Vector3 dest = hit.collider != null ? hit.point - Camera.main.transform.forward * 0.5f : player.position + Camera.main.transform.forward * 30; Vector3 dest = hit.collider != null ? hit.point - Camera.main.transform.forward * 0.5f : player.position + Camera.main.transform.forward * dashDistance;
const float skillTime = 0.2f;
foreach (var enemyHit in Physics.RaycastAll(ray, 30, 1 << LayerMask.NameToLayer("Enemy")))
{
enemyHit.collider.GetComponent<Enemy>()?.GetDamaged(weaponDamage);
}
player.GetComponent<MeshRenderer>().enabled = false; player.GetComponent<MeshRenderer>().enabled = false;
for (float t = 0; t < skillTime; t += Time.fixedDeltaTime) for (float t = 0; t < dashTime; t += Time.fixedDeltaTime)
{ {
player.position = Vector3.Lerp(oriPos, dest, t / skillTime); player.position = Vector3.Lerp(oriPos, dest, 1 - Mathf.Pow(1 - (t / dashTime),2));
yield return new WaitForFixedUpdate(); yield return new WaitForFixedUpdate();
} }
player.GetComponent<Rigidbody>().velocity = Vector3.zero; player.GetComponent<Rigidbody>().velocity = Vector3.zero;
player.GetComponent<MeshRenderer>().enabled = true; player.GetComponent<MeshRenderer>().enabled = true;
foreach (var enemyHit in Physics.SphereCastAll(ray, 1, Vector3.Distance(oriPos,dest), 1 << LayerMask.NameToLayer("Enemy")))
{
Enemy enemy = enemyHit.collider.GetComponent<Enemy>();
Debug.Log(enemy);
if (enemy == null)
continue;
enemy.GetDamaged(weaponDamage);
if (enemy.IsDead)
skillTimer = 0;
}
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment