summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2022-04-25 14:38:07 +0800
committerchai <chaifix@163.com>2022-04-25 14:38:07 +0800
commitb1b0925ee2acf37639c3d211351d74e957c4d134 (patch)
treee7139984b8ac250a97f2148c47b11d2763d3fc3d
parent7eb9351d905ddf6316fd6b177fff967fbac6fc94 (diff)
* lock aim
-rw-r--r--SurvivalTest/Assets/Resources/Prefabs/weapon/boomerang.prefab151
-rw-r--r--SurvivalTest/Assets/Resources/Scenes/Demo.unity61
-rw-r--r--SurvivalTest/Assets/Scripts/Buff.meta8
-rw-r--r--SurvivalTest/Assets/Scripts/Buff/BuffBase.cs18
-rw-r--r--SurvivalTest/Assets/Scripts/Buff/BuffBase.cs.meta11
-rw-r--r--SurvivalTest/Assets/Scripts/Items/ItemBase.cs2
-rw-r--r--SurvivalTest/Assets/Scripts/Items/Item_Boot.cs2
-rw-r--r--SurvivalTest/Assets/Scripts/Test/TestPeaceMaker.cs58
-rw-r--r--SurvivalTest/Assets/Scripts/Weapons/Boomerang.meta8
-rw-r--r--SurvivalTest/Assets/Scripts/Weapons/Boomerang/Boomerang.cs73
-rw-r--r--SurvivalTest/Assets/Scripts/Weapons/Boomerang/Boomerang.cs.meta11
-rw-r--r--SurvivalTest/Assets/Scripts/Weapons/Boomerang/BoomerangAfterImage.cs26
-rw-r--r--SurvivalTest/Assets/Scripts/Weapons/Boomerang/BoomerangAfterImage.cs.meta11
-rw-r--r--SurvivalTest/Assets/Scripts/Weapons/Boomerang/Weapon_Boomerang.cs56
-rw-r--r--SurvivalTest/Assets/Scripts/Weapons/Boomerang/Weapon_Boomerang.cs.meta (renamed from SurvivalTest/Assets/Scripts/Weapons/Weapon_Boomerang.cs.meta)0
-rw-r--r--SurvivalTest/Assets/Scripts/Weapons/Weapon_Boomerang.cs34
-rw-r--r--SurvivalTest/ProjectSettings/InputManager.asset16
17 files changed, 493 insertions, 53 deletions
diff --git a/SurvivalTest/Assets/Resources/Prefabs/weapon/boomerang.prefab b/SurvivalTest/Assets/Resources/Prefabs/weapon/boomerang.prefab
index a28aa2f..6d74684 100644
--- a/SurvivalTest/Assets/Resources/Prefabs/weapon/boomerang.prefab
+++ b/SurvivalTest/Assets/Resources/Prefabs/weapon/boomerang.prefab
@@ -1,5 +1,139 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
+--- !u!1 &5185661606594013254
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 5185661606594013248}
+ - component: {fileID: 5185661606594013255}
+ - component: {fileID: 4945438405523546994}
+ - component: {fileID: 5185661606594013256}
+ m_Layer: 0
+ m_Name: afterimage
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 0
+--- !u!4 &5185661606594013248
+Transform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 5185661606594013254}
+ 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: 8793587622498110537}
+ m_RootOrder: 0
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+--- !u!212 &5185661606594013255
+SpriteRenderer:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 5185661606594013254}
+ m_Enabled: 1
+ m_CastShadows: 0
+ m_ReceiveShadows: 0
+ m_DynamicOccludee: 1
+ m_MotionVectors: 1
+ m_LightProbeUsage: 1
+ m_ReflectionProbeUsage: 1
+ m_RayTracingMode: 0
+ m_RayTraceProcedural: 0
+ m_RenderingLayerMask: 1
+ m_RendererPriority: 0
+ m_Materials:
+ - {fileID: 10754, 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: 0
+ m_MinimumChartSize: 4
+ m_AutoUVMaxDistance: 0.5
+ m_AutoUVMaxAngle: 89
+ m_LightmapParameters: {fileID: 0}
+ m_SortingLayerID: 0
+ m_SortingLayer: 0
+ m_SortingOrder: -1
+ m_Sprite: {fileID: 21300000, guid: b2408a123aae0c64090a7bf85cbfafb3, type: 3}
+ m_Color: {r: 1, g: 1, b: 1, a: 1}
+ m_FlipX: 0
+ m_FlipY: 0
+ m_DrawMode: 0
+ m_Size: {x: 1.40625, y: 1.3125}
+ m_AdaptiveModeThreshold: 0.5
+ m_SpriteTileMode: 0
+ m_WasSpriteAssigned: 1
+ m_MaskInteraction: 0
+ m_SpriteSortPoint: 0
+--- !u!114 &4945438405523546994
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 5185661606594013254}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: a6a150d5108a43f4386bda3a1707d743, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ sr: {fileID: 5185661606594013255}
+--- !u!114 &5185661606594013256
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 5185661606594013254}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: 6bde42b3ff5cbc44ca4e036544c3cde9, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ lifeTime: 0.2
+ alphaCurve:
+ serializedVersion: 2
+ m_Curve:
+ - serializedVersion: 3
+ time: 0
+ value: 1
+ inSlope: -1
+ outSlope: -1
+ tangentMode: 34
+ weightedMode: 0
+ inWeight: 0
+ outWeight: 0.33333334
+ - serializedVersion: 3
+ time: 1
+ value: 0
+ inSlope: -1
+ outSlope: -1
+ tangentMode: 34
+ weightedMode: 0
+ inWeight: 0.33333334
+ outWeight: 0
+ m_PreInfinity: 2
+ m_PostInfinity: 2
+ m_RotationOrder: 4
--- !u!1 &8793587622498110543
GameObject:
m_ObjectHideFlags: 0
@@ -10,6 +144,7 @@ GameObject:
m_Component:
- component: {fileID: 8793587622498110537}
- component: {fileID: 8793587622498110542}
+ - component: {fileID: 1329345119}
m_Layer: 0
m_Name: boomerang
m_TagString: Untagged
@@ -27,7 +162,8 @@ Transform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0.328, y: 1.086, z: 0}
m_LocalScale: {x: 0.5, y: 0.5, z: 1}
- m_Children: []
+ m_Children:
+ - {fileID: 5185661606594013248}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@@ -82,3 +218,16 @@ SpriteRenderer:
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 0
+--- !u!114 &1329345119
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 8793587622498110543}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: 4679a949f0f94fe47b708ff7b0d7ffb9, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_AfterImage: {fileID: 4945438405523546994}
diff --git a/SurvivalTest/Assets/Resources/Scenes/Demo.unity b/SurvivalTest/Assets/Resources/Scenes/Demo.unity
index b1a24b2..d95aa8e 100644
--- a/SurvivalTest/Assets/Resources/Scenes/Demo.unity
+++ b/SurvivalTest/Assets/Resources/Scenes/Demo.unity
@@ -1907,6 +1907,67 @@ PrefabInstance:
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 779262af2df6cab4ab893e9884f5bf74, type: 3}
+--- !u!1001 &1329345117
+PrefabInstance:
+ m_ObjectHideFlags: 0
+ serializedVersion: 2
+ m_Modification:
+ m_TransformParent: {fileID: 0}
+ m_Modifications:
+ - target: {fileID: 8793587622498110537, guid: 606488edded27994bbfddc85154bc71c, type: 3}
+ propertyPath: m_RootOrder
+ value: 20
+ objectReference: {fileID: 0}
+ - target: {fileID: 8793587622498110537, guid: 606488edded27994bbfddc85154bc71c, type: 3}
+ propertyPath: m_LocalPosition.x
+ value: 0.328
+ objectReference: {fileID: 0}
+ - target: {fileID: 8793587622498110537, guid: 606488edded27994bbfddc85154bc71c, type: 3}
+ propertyPath: m_LocalPosition.y
+ value: 1.086
+ objectReference: {fileID: 0}
+ - target: {fileID: 8793587622498110537, guid: 606488edded27994bbfddc85154bc71c, type: 3}
+ propertyPath: m_LocalPosition.z
+ value: 0
+ objectReference: {fileID: 0}
+ - target: {fileID: 8793587622498110537, guid: 606488edded27994bbfddc85154bc71c, type: 3}
+ propertyPath: m_LocalRotation.w
+ value: 1
+ objectReference: {fileID: 0}
+ - target: {fileID: 8793587622498110537, guid: 606488edded27994bbfddc85154bc71c, type: 3}
+ propertyPath: m_LocalRotation.x
+ value: 0
+ objectReference: {fileID: 0}
+ - target: {fileID: 8793587622498110537, guid: 606488edded27994bbfddc85154bc71c, type: 3}
+ propertyPath: m_LocalRotation.y
+ value: 0
+ objectReference: {fileID: 0}
+ - target: {fileID: 8793587622498110537, guid: 606488edded27994bbfddc85154bc71c, type: 3}
+ propertyPath: m_LocalRotation.z
+ value: 0
+ objectReference: {fileID: 0}
+ - target: {fileID: 8793587622498110537, guid: 606488edded27994bbfddc85154bc71c, type: 3}
+ propertyPath: m_LocalEulerAnglesHint.x
+ value: 0
+ objectReference: {fileID: 0}
+ - target: {fileID: 8793587622498110537, guid: 606488edded27994bbfddc85154bc71c, type: 3}
+ propertyPath: m_LocalEulerAnglesHint.y
+ value: 0
+ objectReference: {fileID: 0}
+ - target: {fileID: 8793587622498110537, guid: 606488edded27994bbfddc85154bc71c, type: 3}
+ propertyPath: m_LocalEulerAnglesHint.z
+ value: 0
+ objectReference: {fileID: 0}
+ - target: {fileID: 8793587622498110543, guid: 606488edded27994bbfddc85154bc71c, type: 3}
+ propertyPath: m_Name
+ value: boomerang
+ objectReference: {fileID: 0}
+ - target: {fileID: 8793587622498110543, guid: 606488edded27994bbfddc85154bc71c, type: 3}
+ propertyPath: m_IsActive
+ value: 0
+ objectReference: {fileID: 0}
+ m_RemovedComponents: []
+ m_SourcePrefab: {fileID: 100100000, guid: 606488edded27994bbfddc85154bc71c, type: 3}
--- !u!1 &1406907911
GameObject:
m_ObjectHideFlags: 0
diff --git a/SurvivalTest/Assets/Scripts/Buff.meta b/SurvivalTest/Assets/Scripts/Buff.meta
new file mode 100644
index 0000000..e60844c
--- /dev/null
+++ b/SurvivalTest/Assets/Scripts/Buff.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 4433b6b2b33098a4cb8751a508e130de
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/SurvivalTest/Assets/Scripts/Buff/BuffBase.cs b/SurvivalTest/Assets/Scripts/Buff/BuffBase.cs
new file mode 100644
index 0000000..4e8149a
--- /dev/null
+++ b/SurvivalTest/Assets/Scripts/Buff/BuffBase.cs
@@ -0,0 +1,18 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+public class BuffBase : MonoBehaviour
+{
+ // Start is called before the first frame update
+ void Start()
+ {
+
+ }
+
+ // Update is called once per frame
+ void Update()
+ {
+
+ }
+}
diff --git a/SurvivalTest/Assets/Scripts/Buff/BuffBase.cs.meta b/SurvivalTest/Assets/Scripts/Buff/BuffBase.cs.meta
new file mode 100644
index 0000000..863f7d5
--- /dev/null
+++ b/SurvivalTest/Assets/Scripts/Buff/BuffBase.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: e9640ba90ab79b046a3a331f704dfaf2
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/SurvivalTest/Assets/Scripts/Items/ItemBase.cs b/SurvivalTest/Assets/Scripts/Items/ItemBase.cs
index 7e4414f..e7cecd6 100644
--- a/SurvivalTest/Assets/Scripts/Items/ItemBase.cs
+++ b/SurvivalTest/Assets/Scripts/Items/ItemBase.cs
@@ -3,7 +3,7 @@ using System.Collections.Generic;
using UnityEngine;
/// <summary>
-/// 饰品,加BUFF
+/// 物品,可以加Buff、提升属性、技能附加效果
/// </summary>
public class ItemBase : MonoBehaviour
{
diff --git a/SurvivalTest/Assets/Scripts/Items/Item_Boot.cs b/SurvivalTest/Assets/Scripts/Items/Item_Boot.cs
index 1421a35..4a31d57 100644
--- a/SurvivalTest/Assets/Scripts/Items/Item_Boot.cs
+++ b/SurvivalTest/Assets/Scripts/Items/Item_Boot.cs
@@ -3,7 +3,7 @@ using System.Collections.Generic;
using UnityEngine;
/// <summary>
-/// 靴子
+/// 靴子,提升移动速度、冲刺
/// </summary>
public class Item_Boot : ItemBase
{
diff --git a/SurvivalTest/Assets/Scripts/Test/TestPeaceMaker.cs b/SurvivalTest/Assets/Scripts/Test/TestPeaceMaker.cs
index 57bd46f..e4e3879 100644
--- a/SurvivalTest/Assets/Scripts/Test/TestPeaceMaker.cs
+++ b/SurvivalTest/Assets/Scripts/Test/TestPeaceMaker.cs
@@ -72,9 +72,13 @@ public class TestPeaceMaker : CrewScript
private Vector3 m_PreMouse;
private Vector2 m_AimDirection;
+ private Vector2 m_MoveDirection;
private Vector3 m_TargetZoom;
+ // 锁定瞄准,以移动方向为准
+ private bool m_LockAim;
+
private enum ControlMode
{
Mouse,
@@ -99,6 +103,8 @@ public class TestPeaceMaker : CrewScript
void Update()
{
+ LockAim();
+
bool isMove = Move();
SetAim();
@@ -110,6 +116,14 @@ public class TestPeaceMaker : CrewScript
CameraZoom(isFire);
}
+ void LockAim()
+ {
+ if(Input.GetButtonDown("LockAim"))
+ {
+ m_LockAim = !m_LockAim;
+ }
+ }
+
void CameraZoom(bool zout)
{
if(zout)
@@ -147,6 +161,8 @@ public class TestPeaceMaker : CrewScript
{
Vector2 direction = new Vector2(x, y).normalized;
+ m_MoveDirection = direction;
+
Vector3 position = m_Coord.position;
position.x += direction.x * m_Speed * Time.deltaTime;
position.y += direction.y * m_Speed * Time.deltaTime;
@@ -170,6 +186,9 @@ public class TestPeaceMaker : CrewScript
void SetAim()
{
+ Vector2 dir = Vector2.zero;
+ Vector2 centrePos = m_Centre.position;
+
float xAxis = Input.GetAxisRaw("AimHorizontal");
float yAxis = Input.GetAxisRaw("AimVertical");
@@ -178,28 +197,35 @@ public class TestPeaceMaker : CrewScript
bool bMouse = (Input.mousePosition - m_PreMouse).magnitude > 0.01f;
m_PreMouse = Input.mousePosition;
- if(bJoytick)
- {
- m_ControlMode = ControlMode.Joystick;
- }
- if(bMouse)
- {
- m_ControlMode = ControlMode.Mouse;
- }
-
- Vector2 centrePos = m_Centre.position;
- Vector2 dir = Vector2.zero;
- if (m_ControlMode == ControlMode.Mouse)
+ if (m_LockAim && !bJoytick && !bMouse)
{
- Vector2 camPos = GetCameraPosition();
- dir = (camPos - centrePos).normalized;
+ dir = m_MoveDirection;
}
else
{
- dir = new Vector2(xAxis, -yAxis).normalized;
+ m_LockAim = false;
+
+ if (bJoytick)
+ {
+ m_ControlMode = ControlMode.Joystick;
+ }
+ if (bMouse)
+ {
+ m_ControlMode = ControlMode.Mouse;
+ }
+
+ if (m_ControlMode == ControlMode.Mouse)
+ {
+ Vector2 camPos = GetCameraPosition();
+ dir = (camPos - centrePos).normalized;
+ }
+ else
+ {
+ dir = new Vector2(xAxis, -yAxis).normalized;
+ }
}
- if(dir.magnitude > 0)
+ if (dir.magnitude > 0)
{
m_AimDirection = dir;
Vector2 arrowPos = centrePos + m_ArrowRadius * m_AimDirection;
diff --git a/SurvivalTest/Assets/Scripts/Weapons/Boomerang.meta b/SurvivalTest/Assets/Scripts/Weapons/Boomerang.meta
new file mode 100644
index 0000000..3ed9b00
--- /dev/null
+++ b/SurvivalTest/Assets/Scripts/Weapons/Boomerang.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: ec5e14b226b545d4fb3041c338d56321
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/SurvivalTest/Assets/Scripts/Weapons/Boomerang/Boomerang.cs b/SurvivalTest/Assets/Scripts/Weapons/Boomerang/Boomerang.cs
new file mode 100644
index 0000000..5d2a5bb
--- /dev/null
+++ b/SurvivalTest/Assets/Scripts/Weapons/Boomerang/Boomerang.cs
@@ -0,0 +1,73 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+/// <summary>
+/// 回旋镖
+/// </summary>
+public class Boomerang : MonoBehaviour
+{
+ public BoomerangAfterImage m_AfterImage;
+
+ private Vector2 m_Direction;
+
+ // 当前速度
+ private float m_Speed;
+
+ // 最大飞行距离
+ private float m_MaxDist;
+
+ private float m_RotateSpeed = 500f;
+
+ Coroutine m_CoAfterImage;
+
+ public void Set(Vector2 dir, float speed, float maxDist)
+ {
+ m_Direction = dir;
+ m_Speed = speed;
+ m_MaxDist = maxDist;
+
+ m_CoAfterImage = StartCoroutine(CoAfterImage(0.05f));
+ }
+
+ private void Update()
+ {
+ Vector2 move = m_Direction * m_Speed * Time.deltaTime;
+
+ m_MaxDist -= move.magnitude;
+ if(m_MaxDist <= 0)
+ {
+ Destroy(this.gameObject);
+
+ if (m_CoAfterImage != null)
+ {
+ StopCoroutine(m_CoAfterImage);
+ }
+
+ return;
+ }
+
+ Vector3 pos = transform.position;
+ pos += new Vector3(move.x, move.y, 0);
+
+ transform.position = pos;
+
+ transform.rotation *= Quaternion.Euler(0,0,m_RotateSpeed * Time.deltaTime);
+ }
+
+ IEnumerator CoAfterImage(float interval)
+ {
+ while (true)
+ {
+ BoomerangAfterImage afterImage = BoomerangAfterImage.Instantiate(m_AfterImage);
+ afterImage.Set(this);
+ afterImage.transform.position = this.transform.position;
+ afterImage.transform.localScale= new Vector3(0.5f, 0.5f, 1f);
+ afterImage.transform.rotation = this.transform.rotation;
+ afterImage.gameObject.SetActive(true);
+
+ yield return new WaitForSeconds(interval);
+ }
+ }
+
+} \ No newline at end of file
diff --git a/SurvivalTest/Assets/Scripts/Weapons/Boomerang/Boomerang.cs.meta b/SurvivalTest/Assets/Scripts/Weapons/Boomerang/Boomerang.cs.meta
new file mode 100644
index 0000000..d400625
--- /dev/null
+++ b/SurvivalTest/Assets/Scripts/Weapons/Boomerang/Boomerang.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 4679a949f0f94fe47b708ff7b0d7ffb9
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/SurvivalTest/Assets/Scripts/Weapons/Boomerang/BoomerangAfterImage.cs b/SurvivalTest/Assets/Scripts/Weapons/Boomerang/BoomerangAfterImage.cs
new file mode 100644
index 0000000..25461ae
--- /dev/null
+++ b/SurvivalTest/Assets/Scripts/Weapons/Boomerang/BoomerangAfterImage.cs
@@ -0,0 +1,26 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+public class BoomerangAfterImage : MonoBehaviour
+{
+ public SpriteRenderer sr;
+
+
+ Boomerang m_Boomerang;
+
+ public void Set(Boomerang boomerang)
+ {
+ m_Boomerang = boomerang;
+ }
+
+ private void Update()
+ {
+ //sr.sprite = m_Boomerang.GetComponent<SpriteRenderer>().sprite;
+ if(m_Boomerang != null)
+ {
+ //this.transform.rotation = m_Boomerang.transform.rotation;
+ }
+ }
+
+} \ No newline at end of file
diff --git a/SurvivalTest/Assets/Scripts/Weapons/Boomerang/BoomerangAfterImage.cs.meta b/SurvivalTest/Assets/Scripts/Weapons/Boomerang/BoomerangAfterImage.cs.meta
new file mode 100644
index 0000000..28b5eba
--- /dev/null
+++ b/SurvivalTest/Assets/Scripts/Weapons/Boomerang/BoomerangAfterImage.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: a6a150d5108a43f4386bda3a1707d743
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/SurvivalTest/Assets/Scripts/Weapons/Boomerang/Weapon_Boomerang.cs b/SurvivalTest/Assets/Scripts/Weapons/Boomerang/Weapon_Boomerang.cs
new file mode 100644
index 0000000..f5588cd
--- /dev/null
+++ b/SurvivalTest/Assets/Scripts/Weapons/Boomerang/Weapon_Boomerang.cs
@@ -0,0 +1,56 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+/// <summary>
+/// 回旋镖
+/// </summary>
+public class Weapon_Boomerang : WeaponBase
+{
+ public override AutoMode autoMode => AutoMode.Condition;
+
+ public override string name => "回旋镖";
+
+ public override string iconPath => "art/ui/weaponicon/boomerang";
+
+ string prefabPath = "prefabs/weapon/boomerang";
+
+ Boomerang boomerang;
+
+ /// 接到回旋镖后重新掷出,否则间隔一段时间投掷
+ /// </summary>
+ /// <param name="owner"></param>
+ /// <returns></returns>
+ public override bool CheckCondition(GameObject owner)
+ {
+ return true;
+ }
+
+ public override void OnInitialize(GameObject owner)
+ {
+ base.OnInitialize(owner);
+ boomerang = null;
+ }
+
+ public override void OnTrigger(GameObject owner)
+ {
+ if (boomerang == null)
+ {
+ boomerang = UnityEngine.Object.Instantiate<Boomerang>(ResourceManager.Instance.Load<Boomerang>(prefabPath));
+ CrewScript crew = owner.GetComponent<CrewScript>();
+ Vector3 pos = crew.centre.position + new Vector3(crew.aimDirection.x, crew.aimDirection.y, 0) * 0.3f;
+ boomerang.transform.position = pos;
+ boomerang.Set(crew.aimDirection, 10f, 10f);
+ }
+ }
+
+ public override void OnStop(GameObject owner)
+ {
+
+ }
+
+ public override void Update(GameObject owner)
+ {
+ }
+
+} \ No newline at end of file
diff --git a/SurvivalTest/Assets/Scripts/Weapons/Weapon_Boomerang.cs.meta b/SurvivalTest/Assets/Scripts/Weapons/Boomerang/Weapon_Boomerang.cs.meta
index 401fde6..401fde6 100644
--- a/SurvivalTest/Assets/Scripts/Weapons/Weapon_Boomerang.cs.meta
+++ b/SurvivalTest/Assets/Scripts/Weapons/Boomerang/Weapon_Boomerang.cs.meta
diff --git a/SurvivalTest/Assets/Scripts/Weapons/Weapon_Boomerang.cs b/SurvivalTest/Assets/Scripts/Weapons/Weapon_Boomerang.cs
deleted file mode 100644
index d701c83..0000000
--- a/SurvivalTest/Assets/Scripts/Weapons/Weapon_Boomerang.cs
+++ /dev/null
@@ -1,34 +0,0 @@
-using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-
-/// <summary>
-/// 回旋镖
-/// </summary>
-public class Weapon_Boomerang : WeaponBase
-{
- public override AutoMode autoMode => AutoMode.Condition;
-
- public override string name => "回旋镖";
-
- public override string iconPath => "art/ui/weaponicon/boomerang";
-
- /// <summary>
- /// 接到回旋镖后重新掷出,否则间隔一段时间投掷
- /// </summary>
- /// <param name="owner"></param>
- /// <returns></returns>
- public override bool CheckCondition(GameObject owner)
- {
- return false;
- }
-
- public override void OnTrigger(GameObject owner)
- {
- }
-
- public override void Update(GameObject owner)
- {
- }
-
-} \ No newline at end of file
diff --git a/SurvivalTest/ProjectSettings/InputManager.asset b/SurvivalTest/ProjectSettings/InputManager.asset
index 1a8154e..12c11cf 100644
--- a/SurvivalTest/ProjectSettings/InputManager.asset
+++ b/SurvivalTest/ProjectSettings/InputManager.asset
@@ -597,3 +597,19 @@ InputManager:
type: 0
axis: 0
joyNum: 0
+ - serializedVersion: 3
+ m_Name: LockAim
+ descriptiveName:
+ descriptiveNegativeName:
+ negativeButton:
+ positiveButton: joystick button 9
+ altNegativeButton:
+ altPositiveButton:
+ gravity: 1000
+ dead: 0.001
+ sensitivity: 1000
+ snap: 0
+ invert: 0
+ type: 0
+ axis: 0
+ joyNum: 0