add
This commit is contained in:
parent
b18f1e9a34
commit
c7d9c66033
8
TheStrongestSnail/Assets/Resources/RacingPanel.meta
Normal file
8
TheStrongestSnail/Assets/Resources/RacingPanel.meta
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 001c49eac6929784ea1d81b41c53c2dc
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
143
TheStrongestSnail/Assets/Resources/RacingPanel/Image.prefab
Normal file
143
TheStrongestSnail/Assets/Resources/RacingPanel/Image.prefab
Normal file
@ -0,0 +1,143 @@
|
|||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!1 &8461295688368162796
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 8461295688368162787}
|
||||||
|
- component: {fileID: 8461295688368162791}
|
||||||
|
- component: {fileID: 8461295688368162784}
|
||||||
|
- component: {fileID: 8461295688368162785}
|
||||||
|
- component: {fileID: 8461295688368162786}
|
||||||
|
- component: {fileID: 8641404947999652021}
|
||||||
|
m_Layer: 5
|
||||||
|
m_Name: Image
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!224 &8461295688368162787
|
||||||
|
RectTransform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 8461295688368162796}
|
||||||
|
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_ConstrainProportionsScale: 0
|
||||||
|
m_Children: []
|
||||||
|
m_Father: {fileID: 0}
|
||||||
|
m_RootOrder: 0
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||||
|
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||||
|
m_AnchoredPosition: {x: -252, y: 481}
|
||||||
|
m_SizeDelta: {x: 105, y: 105}
|
||||||
|
m_Pivot: {x: 0.5, y: 0.5}
|
||||||
|
--- !u!222 &8461295688368162791
|
||||||
|
CanvasRenderer:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 8461295688368162796}
|
||||||
|
m_CullTransparentMesh: 1
|
||||||
|
--- !u!114 &8461295688368162784
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 8461295688368162796}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
m_Material: {fileID: 0}
|
||||||
|
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||||
|
m_RaycastTarget: 1
|
||||||
|
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||||
|
m_Maskable: 1
|
||||||
|
m_OnCullStateChanged:
|
||||||
|
m_PersistentCalls:
|
||||||
|
m_Calls: []
|
||||||
|
m_Sprite: {fileID: 21300000, guid: 8181f1fe844c5004b9cf1b3c74ed4f8a, type: 3}
|
||||||
|
m_Type: 0
|
||||||
|
m_PreserveAspect: 1
|
||||||
|
m_FillCenter: 1
|
||||||
|
m_FillMethod: 4
|
||||||
|
m_FillAmount: 1
|
||||||
|
m_FillClockwise: 1
|
||||||
|
m_FillOrigin: 0
|
||||||
|
m_UseSpriteMesh: 0
|
||||||
|
m_PixelsPerUnitMultiplier: 1
|
||||||
|
--- !u!61 &8461295688368162785
|
||||||
|
BoxCollider2D:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 8461295688368162796}
|
||||||
|
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, y: 0}
|
||||||
|
oldSize: {x: 0, y: 0}
|
||||||
|
newSize: {x: 0, y: 0}
|
||||||
|
adaptiveTilingThreshold: 0
|
||||||
|
drawMode: 0
|
||||||
|
adaptiveTiling: 0
|
||||||
|
m_AutoTiling: 0
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Size: {x: 100, y: 100}
|
||||||
|
m_EdgeRadius: 0
|
||||||
|
--- !u!50 &8461295688368162786
|
||||||
|
Rigidbody2D:
|
||||||
|
serializedVersion: 4
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 8461295688368162796}
|
||||||
|
m_BodyType: 0
|
||||||
|
m_Simulated: 1
|
||||||
|
m_UseFullKinematicContacts: 0
|
||||||
|
m_UseAutoMass: 0
|
||||||
|
m_Mass: 1
|
||||||
|
m_LinearDrag: 0
|
||||||
|
m_AngularDrag: 0.05
|
||||||
|
m_GravityScale: 1
|
||||||
|
m_Material: {fileID: 0}
|
||||||
|
m_Interpolate: 0
|
||||||
|
m_SleepingMode: 1
|
||||||
|
m_CollisionDetection: 0
|
||||||
|
m_Constraints: 7
|
||||||
|
--- !u!114 &8641404947999652021
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 8461295688368162796}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 10b8ca203750dc94d8c2249c62aba6ae, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
mode: 0
|
||||||
|
accelerate: {fileID: 21300000, guid: 51a03bb378b9d1a43a229e726ca0115c, type: 3}
|
||||||
|
slowDown: {fileID: 21300000, guid: 8181f1fe844c5004b9cf1b3c74ed4f8a, type: 3}
|
@ -0,0 +1,7 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: c20fbee9c3d60534dbeedde52a1d46e1
|
||||||
|
PrefabImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
File diff suppressed because it is too large
Load Diff
8
TheStrongestSnail/Assets/Scripts/RacingPanel.meta
Normal file
8
TheStrongestSnail/Assets/Scripts/RacingPanel.meta
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: dec080014916971418682f63028c5cbb
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
79
TheStrongestSnail/Assets/Scripts/RacingPanel/snailRider.cs
Normal file
79
TheStrongestSnail/Assets/Scripts/RacingPanel/snailRider.cs
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
using DG.Tweening;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.UI;
|
||||||
|
|
||||||
|
public class snailRider : MonoBehaviour
|
||||||
|
{
|
||||||
|
public Image palye;
|
||||||
|
public GameObject obj;
|
||||||
|
public List<Sprite> LightSprite;
|
||||||
|
public GameObject startingPoint;
|
||||||
|
public GameObject end;
|
||||||
|
public bool is_victory = false;//这只蜗牛是否在本回合比赛胜利
|
||||||
|
public bool is_die = false;//这个蜗牛死了没
|
||||||
|
float offset = 0;
|
||||||
|
// Start is called before the first frame update
|
||||||
|
async void Start()
|
||||||
|
{
|
||||||
|
startMove();
|
||||||
|
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
|
if (LightSprite == null) return;
|
||||||
|
foreach (Sprite sprite in LightSprite)
|
||||||
|
{
|
||||||
|
if (palye != null)
|
||||||
|
{
|
||||||
|
palye.sprite = sprite;
|
||||||
|
await Task.Delay(50);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void OnDestroy()
|
||||||
|
{
|
||||||
|
LightSprite = null;
|
||||||
|
}
|
||||||
|
void startMove()
|
||||||
|
{
|
||||||
|
palye.enabled = !is_die;
|
||||||
|
if (!is_die)
|
||||||
|
{
|
||||||
|
float suiji = 0;
|
||||||
|
if (is_victory)
|
||||||
|
{
|
||||||
|
suiji = UnityEngine.Random.Range(-1f,0f);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
suiji = UnityEngine.Random.Range(1f, 5f);
|
||||||
|
}
|
||||||
|
Sequence mySequence = DOTween.Sequence();
|
||||||
|
mySequence.Append(transform.DOMove(startingPoint.transform.position, 0.01f))
|
||||||
|
.Append(transform.DOMove(end.transform.position, 5f + suiji))
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
//+UnityEngine.Random.Range(-2f, 5.0f)
|
||||||
|
}
|
||||||
|
private void Update()
|
||||||
|
{
|
||||||
|
offset = Mathf.Lerp(offset, 0, 1f * Time.deltaTime);
|
||||||
|
obj.transform.localPosition = Vector3.Lerp(obj.transform.localPosition, new Vector3(offset, 0, 0), 1f * Time.deltaTime);
|
||||||
|
}
|
||||||
|
async void OnTriggerEnter2D(Collider2D other)
|
||||||
|
{
|
||||||
|
Destroy(other.gameObject);
|
||||||
|
if (other.gameObject.GetComponent< snailRiderItem >().mode == snailRiderItem.Mode.accelerate)
|
||||||
|
{
|
||||||
|
offset = 500;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
offset = -500;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: b9884f90f97d2d948b64db22526a1cf5
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@ -0,0 +1,29 @@
|
|||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.UI;
|
||||||
|
|
||||||
|
public class snailRiderItem : MonoBehaviour
|
||||||
|
{
|
||||||
|
public enum Mode
|
||||||
|
{
|
||||||
|
accelerate,//źÓËŮ
|
||||||
|
slowDown//źőËŮ
|
||||||
|
}
|
||||||
|
public Mode mode = Mode.accelerate;
|
||||||
|
public Sprite accelerate;
|
||||||
|
public Sprite slowDown;
|
||||||
|
|
||||||
|
private void Update()
|
||||||
|
{
|
||||||
|
if (mode == Mode.accelerate)
|
||||||
|
{
|
||||||
|
GetComponent<Image>().sprite = accelerate;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
GetComponent<Image>().sprite = slowDown;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 10b8ca203750dc94d8c2249c62aba6ae
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
File diff suppressed because one or more lines are too long
@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: eaf95df742d466448b0066449135375f
|
||||||
|
NativeFormatImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
mainObjectFileID: 11400000
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
Loading…
Reference in New Issue
Block a user