_
This commit is contained in:
parent
8961b14820
commit
f874aa51b7
11
Assets/Physic_Materials/Friction.physicsMaterial2D
Normal file
11
Assets/Physic_Materials/Friction.physicsMaterial2D
Normal file
@ -0,0 +1,11 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!62 &6200000
|
||||
PhysicsMaterial2D:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: Friction
|
||||
friction: 0.4
|
||||
bounciness: 0
|
8
Assets/Physic_Materials/Friction.physicsMaterial2D.meta
Normal file
8
Assets/Physic_Materials/Friction.physicsMaterial2D.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 54b5b9dea6a5b2648a07f601a10b330f
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 6200000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -305,6 +305,88 @@ MeshRenderer:
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 0
|
||||
m_AdditionalVertexStreams: {fileID: 0}
|
||||
--- !u!1 &488938061
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 488938063}
|
||||
- component: {fileID: 488938062}
|
||||
m_Layer: 0
|
||||
m_Name: WhiteBg
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!212 &488938062
|
||||
SpriteRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 488938061}
|
||||
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: 2100000, guid: a97c105638bdf8b4a8650670310a4cd3, type: 2}
|
||||
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: 0
|
||||
m_Sprite: {fileID: 7482667652216324306, guid: 48e93eef0688c4a259cb0eddcd8661f7, 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, y: 1}
|
||||
m_AdaptiveModeThreshold: 0.5
|
||||
m_SpriteTileMode: 0
|
||||
m_WasSpriteAssigned: 1
|
||||
m_MaskInteraction: 0
|
||||
m_SpriteSortPoint: 0
|
||||
--- !u!4 &488938063
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 488938061}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0.5144, y: 0.5443, z: 25.4}
|
||||
m_LocalScale: {x: 174.07516, y: 101.02895, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 4
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &698687514
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -656,11 +738,11 @@ Transform:
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1574308003}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 10}
|
||||
m_LocalScale: {x: 4, y: 2, z: 1}
|
||||
m_LocalPosition: {x: 0, y: 0.2048, z: 10}
|
||||
m_LocalScale: {x: 5.155293, y: 2.5266063, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 2
|
||||
m_RootOrder: 3
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &1942352409
|
||||
GameObject:
|
||||
@ -732,5 +814,5 @@ Transform:
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 3
|
||||
m_RootOrder: 2
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
|
@ -11704,7 +11704,7 @@ Transform:
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 998253299}
|
||||
m_RootOrder: 3
|
||||
m_RootOrder: 2
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!82 &737155568
|
||||
AudioSource:
|
||||
@ -11853,36 +11853,6 @@ SpriteRenderer:
|
||||
m_WasSpriteAssigned: 1
|
||||
m_MaskInteraction: 0
|
||||
m_SpriteSortPoint: 0
|
||||
--- !u!1 &752392807
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 752392808}
|
||||
m_Layer: 0
|
||||
m_Name: SpawnStorage
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &752392808
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 752392807}
|
||||
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: 998253299}
|
||||
m_RootOrder: 2
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &806054522
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -17117,7 +17087,6 @@ Transform:
|
||||
m_Children:
|
||||
- {fileID: 1232501490}
|
||||
- {fileID: 448048077}
|
||||
- {fileID: 752392808}
|
||||
- {fileID: 737155567}
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 3
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -26708,7 +26708,7 @@ Transform:
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 1998312655}
|
||||
m_RootOrder: 4
|
||||
m_RootOrder: 3
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &849966909
|
||||
MonoBehaviour:
|
||||
@ -31944,36 +31944,6 @@ ParticleSystem:
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
vectorLabel1_3: W
|
||||
--- !u!1 &1051359889
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1051359890}
|
||||
m_Layer: 0
|
||||
m_Name: SpawnStorage
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &1051359890
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1051359889}
|
||||
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: 1998312655}
|
||||
m_RootOrder: 2
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &1090774852
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -32036,7 +32006,7 @@ Transform:
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 1998312655}
|
||||
m_RootOrder: 3
|
||||
m_RootOrder: 2
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!212 &1131868218
|
||||
SpriteRenderer:
|
||||
@ -53776,7 +53746,6 @@ Transform:
|
||||
m_Children:
|
||||
- {fileID: 1779324125}
|
||||
- {fileID: 1674539833}
|
||||
- {fileID: 1051359890}
|
||||
- {fileID: 1131868217}
|
||||
- {fileID: 849966908}
|
||||
m_Father: {fileID: 0}
|
||||
|
64
Assets/Scripts/Rotation.cs
Normal file
64
Assets/Scripts/Rotation.cs
Normal file
@ -0,0 +1,64 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class Rotation : MonoBehaviour
|
||||
{
|
||||
|
||||
public GameObject rotation_center;
|
||||
public bool static_center = true;
|
||||
public bool right_rotation = true;
|
||||
public bool flipping = false;
|
||||
[Range(0.1f, 8)] [SerializeField] private float speed = 1;
|
||||
[Range(0, (float)Math.PI * 2)] [SerializeField] private float flip_angle = 0;
|
||||
|
||||
private float angle;
|
||||
private float magnitude;
|
||||
private Vector3 rotation_center_position;
|
||||
private Vector3 object_position;
|
||||
private float[] centralized_position;
|
||||
private float flipped_angle = 0;
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
||||
object_position = transform.position;
|
||||
rotation_center_position = rotation_center.transform.position;
|
||||
|
||||
centralized_position = new float[] {object_position[0] - rotation_center_position[0], object_position[1] - rotation_center_position[1]};
|
||||
|
||||
angle = (float)Math.Atan2(centralized_position[0], centralized_position[1]);
|
||||
magnitude = (float)Math.Sqrt(Math.Pow(centralized_position[0], 2) + Math.Pow(centralized_position[1], 2));
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
if (!static_center) {
|
||||
rotation_center_position = rotation_center.transform.position;
|
||||
}
|
||||
|
||||
if (right_rotation) {
|
||||
angle -= speed * Time.deltaTime;
|
||||
} else {
|
||||
angle += speed * Time.deltaTime;
|
||||
}
|
||||
|
||||
if (flipping) {
|
||||
flipped_angle += speed * Time.deltaTime;
|
||||
if (flipped_angle > flip_angle) {
|
||||
right_rotation = !right_rotation;
|
||||
flipped_angle -= flip_angle;
|
||||
}
|
||||
}
|
||||
|
||||
centralized_position = new float[] {(float)Math.Cos(angle) * magnitude, (float)Math.Sin(angle) * magnitude};
|
||||
|
||||
object_position[0] = centralized_position[0] + rotation_center_position[0];
|
||||
object_position[1] = centralized_position[1] + rotation_center_position[1];
|
||||
|
||||
transform.position = object_position;
|
||||
}
|
||||
}
|
11
Assets/Scripts/Rotation.cs.meta
Normal file
11
Assets/Scripts/Rotation.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f4366df60f8ac7f428d235d55b5dfc13
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -15,10 +15,10 @@ EditorUserSettings:
|
||||
value: 22424703114646680e0b0227036c73150012147b623d28393930
|
||||
flags: 0
|
||||
RecentlyUsedScenePath-3:
|
||||
value: 22424703114646680e0b0227036c731500121478623d28393930
|
||||
value: 22424703114646680e0b0227036c6b0502180a232d2468252320092a
|
||||
flags: 0
|
||||
RecentlyUsedScenePath-4:
|
||||
value: 22424703114646680e0b0227036c6b0502180a232d2468252320092a
|
||||
value: 22424703114646680e0b0227036c731500121478623d28393930
|
||||
flags: 0
|
||||
UnityRemoteCompression:
|
||||
value: 337f73
|
||||
|
Loading…
Reference in New Issue
Block a user