damage mult
This commit is contained in:
parent
6e6896d1e4
commit
6ab019909e
@ -14,9 +14,9 @@ AnimatorStateTransition:
|
||||
m_Mute: 0
|
||||
m_IsExit: 0
|
||||
serializedVersion: 3
|
||||
m_TransitionDuration: 0.25
|
||||
m_TransitionOffset: 0
|
||||
m_ExitTime: 0.5098039
|
||||
m_TransitionDuration: 0.19433987
|
||||
m_TransitionOffset: 0.0006336924
|
||||
m_ExitTime: 0.6189414
|
||||
m_HasExitTime: 1
|
||||
m_HasFixedDuration: 1
|
||||
m_InterruptionSource: 0
|
||||
@ -133,9 +133,9 @@ AnimatorStateTransition:
|
||||
m_Mute: 0
|
||||
m_IsExit: 0
|
||||
serializedVersion: 3
|
||||
m_TransitionDuration: 0.25
|
||||
m_TransitionDuration: 0.21950299
|
||||
m_TransitionOffset: 0
|
||||
m_ExitTime: 0.5161291
|
||||
m_ExitTime: 0.57515556
|
||||
m_HasExitTime: 1
|
||||
m_HasFixedDuration: 1
|
||||
m_InterruptionSource: 0
|
||||
|
@ -1163,7 +1163,6 @@ Transform:
|
||||
m_Children:
|
||||
- {fileID: 1884508223}
|
||||
- {fileID: 1847948565}
|
||||
- {fileID: 1185133881}
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!195 &820174472
|
||||
@ -1299,7 +1298,8 @@ GameObject:
|
||||
- component: {fileID: 862052082}
|
||||
- component: {fileID: 862052081}
|
||||
- component: {fileID: 862052080}
|
||||
m_Layer: 0
|
||||
- component: {fileID: 862052084}
|
||||
m_Layer: 6
|
||||
m_Name: Capsule
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
@ -1397,6 +1397,19 @@ Transform:
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &862052084
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 862052079}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: d05ad440f2c88de4a91ec5e324740d7d, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
initHealth: 100
|
||||
--- !u!1 &1060623000
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -1619,61 +1632,6 @@ Transform:
|
||||
m_Children: []
|
||||
m_Father: {fileID: 1091178979}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &1185133880
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1185133881}
|
||||
- component: {fileID: 1185133882}
|
||||
m_Layer: 6
|
||||
m_Name: AimTarget
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &1185133881
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1185133880}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: -2, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 820174471}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!136 &1185133882
|
||||
CapsuleCollider:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1185133880}
|
||||
m_Material: {fileID: 0}
|
||||
m_IncludeLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 0
|
||||
m_ExcludeLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 0
|
||||
m_LayerOverridePriority: 0
|
||||
m_IsTrigger: 1
|
||||
m_ProvidesContacts: 0
|
||||
m_Enabled: 1
|
||||
serializedVersion: 2
|
||||
m_Radius: 2
|
||||
m_Height: 2
|
||||
m_Direction: 1
|
||||
m_Center: {x: 0, y: 2, z: 0}
|
||||
--- !u!1 &1483870827 stripped
|
||||
GameObject:
|
||||
m_CorrespondingSourceObject: {fileID: 919132149155446097, guid: a0b56cb96370346c29fa346cedbbc0f4, type: 3}
|
||||
@ -2707,16 +2665,42 @@ MonoBehaviour:
|
||||
minAimDistance: 25
|
||||
maxAimDistance: 20
|
||||
aimCanvas: {fileID: 1965505415}
|
||||
detectionAngle: 7.5
|
||||
dashSpeed: 36
|
||||
dashTime: 0.2
|
||||
dashCooldownTime: 1
|
||||
dashTrail: {fileID: 1931938469}
|
||||
attackMoveSpeed: 1.5
|
||||
_baseDamage: 15
|
||||
_comboStep: 0.01
|
||||
_comboCurve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 1
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 0
|
||||
weightedMode: 0
|
||||
inWeight: 0
|
||||
outWeight: 0
|
||||
- serializedVersion: 3
|
||||
time: 1
|
||||
value: 10
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 0
|
||||
weightedMode: 0
|
||||
inWeight: 0
|
||||
outWeight: 0
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
_enemyLayer:
|
||||
serializedVersion: 2
|
||||
m_Bits: 64
|
||||
_hurtBox: {fileID: 703790485}
|
||||
_basedamage: 15
|
||||
_availableAttacks:
|
||||
- Left
|
||||
- Right
|
||||
|
@ -32,6 +32,9 @@ public class Player : MonoBehaviour
|
||||
private float maxAimDistance;
|
||||
[SerializeField]
|
||||
private Canvas aimCanvas;
|
||||
[SerializeField]
|
||||
[Range(0f, 20f)]
|
||||
private float detectionAngle=5f;
|
||||
|
||||
[Header("Dash")]
|
||||
[Range(0f, 100f)]
|
||||
@ -47,13 +50,19 @@ public class Player : MonoBehaviour
|
||||
[Range(0f, 10f)]
|
||||
[SerializeField]
|
||||
private float attackMoveSpeed = 2f;
|
||||
[Range(0f, 30f)]
|
||||
[SerializeField]
|
||||
private float _baseDamage;
|
||||
[SerializeField]
|
||||
[Range(0f, 0.1f)]
|
||||
private float _comboStep;
|
||||
[SerializeField]
|
||||
private AnimationCurve _comboCurve;
|
||||
[SerializeField]
|
||||
private LayerMask _enemyLayer;
|
||||
[SerializeField]
|
||||
private Collider _hurtBox;
|
||||
[SerializeField]
|
||||
private float _basedamage;
|
||||
[SerializeField]
|
||||
private string[] _availableAttacks;
|
||||
|
||||
private Camera _camera;
|
||||
@ -86,7 +95,7 @@ void SetupGame()
|
||||
_animate = _animator.gameObject.AddComponent<Animate>();
|
||||
_animate.initialize(_animator);
|
||||
_playerAttack = gameObject.AddComponent<PlayerAttack>();
|
||||
_playerAttack.initialize(_inputManager, _enemyLayer, _animate, _hurtBox, _availableAttacks);
|
||||
_playerAttack.initialize(_inputManager, _enemyLayer, _animate, _hurtBox, _availableAttacks, _baseDamage, _comboStep, _comboCurve);
|
||||
|
||||
_playerMove = gameObject.AddComponent<PlayerMove>();
|
||||
_playerMove.initialize(_controller, dashTrail);
|
||||
@ -113,4 +122,5 @@ void Update()
|
||||
|
||||
_animate.AnimateState("Walk", moveInput.magnitude, animationSpeed);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,3 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class PlayerAimRotate : MonoBehaviour
|
||||
@ -24,12 +25,12 @@ public Vector3 AimTarget(float minAimDistance, float maxAimDistance, Camera came
|
||||
Vector3 targetPoint = ray.GetPoint(distance);
|
||||
|
||||
RaycastHit hit;
|
||||
if (Physics.Raycast(transform.position, (targetPoint - transform.position).normalized, out hit, 50f) && hit.collider.name == "AimTarget")
|
||||
if (Physics.Raycast(transform.position, (targetPoint - transform.position).normalized, out hit, maxAimDistance, LayerMask.GetMask("Enemy")))
|
||||
{
|
||||
Vector3 aimTargetPosition = hit.collider.transform.position;
|
||||
float distanceToTarget = Vector3.Distance(transform.position, aimTargetPosition);
|
||||
|
||||
float assistStrength = Mathf.Clamp((distanceToTarget - minAimDistance) / (maxAimDistance - minAimDistance), 0f, .6f);
|
||||
float assistStrength = Mathf.Clamp(1-((maxAimDistance - minAimDistance) / (distanceToTarget - minAimDistance)), 0f, .6f);
|
||||
|
||||
targetPoint = Vector3.Lerp(targetPoint, aimTargetPosition, assistStrength);
|
||||
//targetPoint = hit.collider.transform.position;
|
||||
@ -40,7 +41,7 @@ public Vector3 AimTarget(float minAimDistance, float maxAimDistance, Camera came
|
||||
|
||||
return _lastLookTarget;
|
||||
}
|
||||
|
||||
|
||||
public void ApplyRotation(Vector3 aimTarget)
|
||||
{
|
||||
aimTarget.y = _canvas.transform.position.y;
|
||||
|
@ -5,6 +5,7 @@
|
||||
using Unity.VisualScripting;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
using Random = System.Random;
|
||||
|
||||
public class PlayerAttack : MonoBehaviour
|
||||
{
|
||||
@ -13,13 +14,21 @@ public class PlayerAttack : MonoBehaviour
|
||||
private Animate _animate;
|
||||
private Collider _hurtbox;
|
||||
private string[] _availableAttacks;
|
||||
public void initialize(InputManager inputManager, LayerMask enemyLayermask, Animate animate, Collider hurtbox, string[] availableAttacks)
|
||||
private float _baseDamage;
|
||||
private float _comboStep;
|
||||
private float _currentComboStep;
|
||||
private AnimationCurve _comboCurve;
|
||||
public void initialize(InputManager inputManager, LayerMask enemyLayermask, Animate animate, Collider hurtbox, string[] availableAttacks, float baseDamage, float comboStep, AnimationCurve comboCurve)
|
||||
{
|
||||
_inputManager = inputManager;
|
||||
_enemyLayermask = enemyLayermask;
|
||||
_hurtbox = hurtbox;
|
||||
_animate = animate;
|
||||
_availableAttacks = availableAttacks;
|
||||
_baseDamage = baseDamage;
|
||||
_comboStep = comboStep;
|
||||
_comboCurve = comboCurve;
|
||||
_currentComboStep = 0f;
|
||||
|
||||
OnEnable();
|
||||
}
|
||||
@ -52,8 +61,8 @@ private void _onResetHandler()
|
||||
|
||||
private void _onAnimationEndHandler()
|
||||
{
|
||||
print("tf");
|
||||
_attacking = false;
|
||||
_currentComboStep = 0f;
|
||||
}
|
||||
|
||||
private void _onStartDamageHandler()
|
||||
@ -94,17 +103,23 @@ public bool Attack()
|
||||
IEnumerator DealDamage()
|
||||
{
|
||||
_damageEnded = false;
|
||||
List<Collider> damagedColliders = new List<Collider>();
|
||||
while (!_damageEnded)
|
||||
{
|
||||
Collider[] hitColliders = Physics.OverlapBox(_hurtbox.bounds.center, _hurtbox.bounds.extents, Quaternion.identity, _enemyLayermask);
|
||||
|
||||
for (int i = 0; i < hitColliders.Length; i++)
|
||||
{
|
||||
//damage code
|
||||
//hitColliders
|
||||
}
|
||||
|
||||
foreach (Collider enemy in hitColliders)
|
||||
{
|
||||
if (!damagedColliders.Contains(enemy))
|
||||
{
|
||||
damagedColliders.Add(enemy);
|
||||
enemy.gameObject.GetComponent<Vitals>().Health -= _baseDamage * _comboCurve.Evaluate(_currentComboStep);
|
||||
}
|
||||
}
|
||||
yield return null;
|
||||
}
|
||||
|
||||
Random rnd = new Random();
|
||||
_currentComboStep += _comboStep * (rnd.Next(1, 10)/10f);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user