mirror of
https://github.com/zoriya/Mimireisu.git
synced 2025-12-06 06:36:09 +00:00
Movement system changed.
This commit is contained in:
@@ -23,7 +23,7 @@ GameObject:
|
||||
- component: {fileID: 58793106304222314}
|
||||
- component: {fileID: 50374050283590292}
|
||||
- component: {fileID: 233121803711999886}
|
||||
m_Layer: 0
|
||||
m_Layer: 8
|
||||
m_Name: Mi
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
|
||||
@@ -336,6 +336,106 @@ Prefab:
|
||||
m_RemovedComponents: []
|
||||
m_ParentPrefab: {fileID: 100100000, guid: 6ffa9e4f03b5e9e48963b7243568dc62, type: 2}
|
||||
m_IsPrefabParent: 0
|
||||
--- !u!1 &1025653815
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
serializedVersion: 5
|
||||
m_Component:
|
||||
- component: {fileID: 1025653818}
|
||||
- component: {fileID: 1025653817}
|
||||
- component: {fileID: 1025653816}
|
||||
m_Layer: 0
|
||||
m_Name: Grass-Middle (3)
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!61 &1025653816
|
||||
BoxCollider2D:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_GameObject: {fileID: 1025653815}
|
||||
m_Enabled: 1
|
||||
m_Density: 1
|
||||
m_Material: {fileID: 0}
|
||||
m_IsTrigger: 0
|
||||
m_UsedByEffector: 0
|
||||
m_UsedByComposite: 0
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_SpriteTilingProperty:
|
||||
border: {x: 0, y: 0, z: 0, w: 0}
|
||||
pivot: {x: 0.5, y: 0.5}
|
||||
oldSize: {x: 0.5, y: 0.5}
|
||||
newSize: {x: 0.5, y: 0.5}
|
||||
adaptiveTilingThreshold: 0.5
|
||||
drawMode: 0
|
||||
adaptiveTiling: 0
|
||||
m_AutoTiling: 0
|
||||
serializedVersion: 2
|
||||
m_Size: {x: 0.5, y: 0.5}
|
||||
m_EdgeRadius: 0
|
||||
--- !u!212 &1025653817
|
||||
SpriteRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_GameObject: {fileID: 1025653815}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 0
|
||||
m_ReceiveShadows: 0
|
||||
m_DynamicOccludee: 1
|
||||
m_MotionVectors: 1
|
||||
m_LightProbeUsage: 1
|
||||
m_ReflectionProbeUsage: 1
|
||||
m_RenderingLayerMask: 4294967295
|
||||
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_PreserveUVs: 0
|
||||
m_IgnoreNormalsForChartDetection: 0
|
||||
m_ImportantGI: 0
|
||||
m_StitchLightmapSeams: 0
|
||||
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: 0
|
||||
m_Sprite: {fileID: 21300000, guid: 9c2dea53371f58841be290a540505639, type: 3}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_FlipX: 0
|
||||
m_FlipY: 0
|
||||
m_DrawMode: 0
|
||||
m_Size: {x: 0.5, y: 0.5}
|
||||
m_AdaptiveModeThreshold: 0.5
|
||||
m_SpriteTileMode: 0
|
||||
m_WasSpriteAssigned: 1
|
||||
m_MaskInteraction: 0
|
||||
--- !u!4 &1025653818
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_GameObject: {fileID: 1025653815}
|
||||
m_LocalRotation: {x: 0, y: 0, z: -0.7071068, w: 0.7071068}
|
||||
m_LocalPosition: {x: -11.38, y: 4.5298, z: 0}
|
||||
m_LocalScale: {x: 9709.372, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 5
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: -90}
|
||||
--- !u!1 &1138483822
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -536,3 +636,103 @@ Transform:
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 4
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 90}
|
||||
--- !u!1 &1889974661
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
serializedVersion: 5
|
||||
m_Component:
|
||||
- component: {fileID: 1889974664}
|
||||
- component: {fileID: 1889974663}
|
||||
- component: {fileID: 1889974662}
|
||||
m_Layer: 0
|
||||
m_Name: Grass-Middle (4)
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!61 &1889974662
|
||||
BoxCollider2D:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_GameObject: {fileID: 1889974661}
|
||||
m_Enabled: 1
|
||||
m_Density: 1
|
||||
m_Material: {fileID: 0}
|
||||
m_IsTrigger: 0
|
||||
m_UsedByEffector: 0
|
||||
m_UsedByComposite: 0
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_SpriteTilingProperty:
|
||||
border: {x: 0, y: 0, z: 0, w: 0}
|
||||
pivot: {x: 0.5, y: 0.5}
|
||||
oldSize: {x: 0.5, y: 0.5}
|
||||
newSize: {x: 0.5, y: 0.5}
|
||||
adaptiveTilingThreshold: 0.5
|
||||
drawMode: 0
|
||||
adaptiveTiling: 0
|
||||
m_AutoTiling: 0
|
||||
serializedVersion: 2
|
||||
m_Size: {x: 0.5, y: 0.5}
|
||||
m_EdgeRadius: 0
|
||||
--- !u!212 &1889974663
|
||||
SpriteRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_GameObject: {fileID: 1889974661}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 0
|
||||
m_ReceiveShadows: 0
|
||||
m_DynamicOccludee: 1
|
||||
m_MotionVectors: 1
|
||||
m_LightProbeUsage: 1
|
||||
m_ReflectionProbeUsage: 1
|
||||
m_RenderingLayerMask: 4294967295
|
||||
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_PreserveUVs: 0
|
||||
m_IgnoreNormalsForChartDetection: 0
|
||||
m_ImportantGI: 0
|
||||
m_StitchLightmapSeams: 0
|
||||
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: 0
|
||||
m_Sprite: {fileID: 21300000, guid: 9c2dea53371f58841be290a540505639, type: 3}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_FlipX: 0
|
||||
m_FlipY: 0
|
||||
m_DrawMode: 0
|
||||
m_Size: {x: 0.5, y: 0.5}
|
||||
m_AdaptiveModeThreshold: 0.5
|
||||
m_SpriteTileMode: 0
|
||||
m_WasSpriteAssigned: 1
|
||||
m_MaskInteraction: 0
|
||||
--- !u!4 &1889974664
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_GameObject: {fileID: 1889974661}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0.7071068, w: 0.7071068}
|
||||
m_LocalPosition: {x: 11.51, y: 4.53, z: 0}
|
||||
m_LocalScale: {x: 9709.372, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 6
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 90}
|
||||
|
||||
@@ -6,7 +6,7 @@ public class Earthworm : MonoBehaviour
|
||||
public GameObject LinePrefab;
|
||||
public GameObject MiPrefab;
|
||||
public float force = 10;
|
||||
public float distance = 20;
|
||||
public float ropeSpeed = 2;
|
||||
public LayerMask mask;
|
||||
|
||||
private Vector3 position;
|
||||
@@ -17,6 +17,8 @@ public class Earthworm : MonoBehaviour
|
||||
{
|
||||
position = transform.GetChild(transform.childCount / 2).position;
|
||||
|
||||
Camera.main.transform.position = new Vector3(Camera.main.transform.position.x, position.y, Camera.main.transform.position.z);
|
||||
|
||||
#region Manette
|
||||
//float horizontal = Input.GetAxis("Horizontal");
|
||||
//float vertical = Input.GetAxis("Vertical");
|
||||
@@ -25,14 +27,15 @@ public class Earthworm : MonoBehaviour
|
||||
Vector3 camera = Camera.main.ScreenToWorldPoint(Input.mousePosition);
|
||||
Vector2 direction = camera - position;
|
||||
|
||||
if (Input.GetKeyDown(KeyCode.A))
|
||||
Grab(KeyCode.A, direction);
|
||||
if (Input.GetKeyDown(KeyCode.Z))
|
||||
Grab(KeyCode.Z, direction);
|
||||
if (Input.GetKeyDown(KeyCode.E))
|
||||
Grab(KeyCode.E, direction);
|
||||
if (Input.GetKeyDown(KeyCode.R) && transform.childCount > 3)
|
||||
Grab(KeyCode.R, direction);
|
||||
if (Input.GetKeyDown(KeyCode.Q))
|
||||
Grab(KeyCode.Q, direction);
|
||||
if (Input.GetKeyDown(KeyCode.D))
|
||||
Grab(KeyCode.D, direction);
|
||||
|
||||
if (Input.GetKey(KeyCode.Z))
|
||||
ChangeRopeSize(-1);
|
||||
if (Input.GetKey(KeyCode.S))
|
||||
ChangeRopeSize(1);
|
||||
|
||||
if (Input.GetKeyDown(KeyCode.Space))
|
||||
AddMi();
|
||||
@@ -40,79 +43,49 @@ public class Earthworm : MonoBehaviour
|
||||
if (Input.GetKeyDown(KeyCode.C))
|
||||
RemoveMi();
|
||||
|
||||
if (Input.GetKeyUp(KeyCode.A) && actions.ContainsKey(KeyCode.A))
|
||||
if (Input.GetKeyUp(KeyCode.Q) && actions.ContainsKey(KeyCode.Q))
|
||||
{
|
||||
Destroy(actions[KeyCode.A].joint);
|
||||
Destroy(actions[KeyCode.A].line);
|
||||
actions.Remove(KeyCode.A);
|
||||
Destroy(actions[KeyCode.Q].joint);
|
||||
Destroy(actions[KeyCode.Q].line);
|
||||
actions.Remove(KeyCode.Q);
|
||||
}
|
||||
if (Input.GetKeyUp(KeyCode.Z) && actions.ContainsKey(KeyCode.Z))
|
||||
if (Input.GetKeyUp(KeyCode.D) && actions.ContainsKey(KeyCode.D))
|
||||
{
|
||||
Destroy(actions[KeyCode.Z].joint);
|
||||
Destroy(actions[KeyCode.Z].line);
|
||||
actions.Remove(KeyCode.Z);
|
||||
}
|
||||
if (Input.GetKeyUp(KeyCode.E) && actions.ContainsKey(KeyCode.E))
|
||||
{
|
||||
Destroy(actions[KeyCode.E].joint);
|
||||
Destroy(actions[KeyCode.E].line);
|
||||
actions.Remove(KeyCode.E);
|
||||
}
|
||||
if (Input.GetKeyUp(KeyCode.R) && actions.ContainsKey(KeyCode.R))
|
||||
{
|
||||
Destroy(actions[KeyCode.R].joint);
|
||||
Destroy(actions[KeyCode.R].line);
|
||||
actions.Remove(KeyCode.R);
|
||||
Destroy(actions[KeyCode.D].joint);
|
||||
Destroy(actions[KeyCode.D].line);
|
||||
actions.Remove(KeyCode.D);
|
||||
}
|
||||
|
||||
foreach(var item in actions)
|
||||
{
|
||||
item.Value.line.GetComponent<LineRenderer>().SetPosition(0, position);
|
||||
}
|
||||
if(actions.ContainsKey(KeyCode.Q))
|
||||
actions[KeyCode.Q].line.GetComponent<LineRenderer>().SetPosition(0, transform.GetChild(0).position);
|
||||
if (actions.ContainsKey(KeyCode.D))
|
||||
actions[KeyCode.D].line.GetComponent<LineRenderer>().SetPosition(0, transform.GetChild(transform.childCount - 1).position);
|
||||
}
|
||||
|
||||
void Grab(KeyCode key, Vector2 direction)
|
||||
{
|
||||
RaycastHit2D hit = Physics2D.Raycast(position, direction, 20, mask);
|
||||
RaycastHit2D hit = Physics2D.Raycast(position, direction, key == KeyCode.Q ? 20 : 150, mask);
|
||||
if (hit.collider != null)
|
||||
{
|
||||
DistanceJoint2D joint = null;
|
||||
switch (key)
|
||||
{
|
||||
case KeyCode.A:
|
||||
case KeyCode.Q:
|
||||
joint = (DistanceJoint2D)transform.GetChild(0).gameObject.AddComponent(typeof(DistanceJoint2D));
|
||||
if (actions.ContainsKey(KeyCode.A))
|
||||
if (actions.ContainsKey(KeyCode.Q))
|
||||
{
|
||||
Destroy(actions[KeyCode.A].joint);
|
||||
Destroy(actions[KeyCode.A].line);
|
||||
actions.Remove(KeyCode.A);
|
||||
Destroy(actions[KeyCode.Q].joint);
|
||||
Destroy(actions[KeyCode.Q].line);
|
||||
actions.Remove(KeyCode.Q);
|
||||
}
|
||||
break;
|
||||
case KeyCode.Z:
|
||||
joint = (DistanceJoint2D)transform.GetChild(transform.childCount == 3 ? 1 : transform.childCount / 4).gameObject.AddComponent(typeof(DistanceJoint2D));
|
||||
if (actions.ContainsKey(KeyCode.Z))
|
||||
{
|
||||
Destroy(actions[KeyCode.Z].joint);
|
||||
Destroy(actions[KeyCode.Z].line);
|
||||
actions.Remove(KeyCode.Z);
|
||||
}
|
||||
break;
|
||||
case KeyCode.E:
|
||||
joint = (DistanceJoint2D)transform.GetChild(transform.childCount * 3 / 4).gameObject.AddComponent(typeof(DistanceJoint2D));
|
||||
if (actions.ContainsKey(KeyCode.E))
|
||||
{
|
||||
Destroy(actions[KeyCode.E].joint);
|
||||
Destroy(actions[KeyCode.E].line);
|
||||
actions.Remove(KeyCode.E);
|
||||
}
|
||||
break;
|
||||
case KeyCode.R:
|
||||
case KeyCode.D:
|
||||
joint = (DistanceJoint2D)transform.GetChild(transform.childCount - 1).gameObject.AddComponent(typeof(DistanceJoint2D));
|
||||
if (actions.ContainsKey(KeyCode.R))
|
||||
if (actions.ContainsKey(KeyCode.D))
|
||||
{
|
||||
Destroy(actions[KeyCode.R].joint);
|
||||
Destroy(actions[KeyCode.R].line);
|
||||
actions.Remove(KeyCode.R);
|
||||
Destroy(actions[KeyCode.D].joint);
|
||||
Destroy(actions[KeyCode.D].line);
|
||||
actions.Remove(KeyCode.D);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@@ -130,6 +103,18 @@ public class Earthworm : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
void ChangeRopeSize(int direction)
|
||||
{
|
||||
if (actions.ContainsKey(KeyCode.Q))
|
||||
{
|
||||
DistanceJoint2D joint = actions[KeyCode.Q].joint;
|
||||
if (direction > 0)
|
||||
joint.distance += Time.deltaTime * ropeSpeed;
|
||||
else
|
||||
joint.distance -= Time.deltaTime * ropeSpeed;
|
||||
}
|
||||
}
|
||||
|
||||
void AddMi()
|
||||
{
|
||||
Transform tsu = transform.GetChild(transform.childCount - 1);
|
||||
|
||||
Reference in New Issue
Block a user