add
This commit is contained in:
parent
b8c82e6612
commit
f22436f772
78
TheStrongestSnail/Assets/Resources/Egg.prefab
Normal file
78
TheStrongestSnail/Assets/Resources/Egg.prefab
Normal file
@ -0,0 +1,78 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &4165079337982117843
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 4004697975411094835}
|
||||
- component: {fileID: 1344378821213387827}
|
||||
- component: {fileID: 7646980951699364853}
|
||||
m_Layer: 5
|
||||
m_Name: Egg
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &4004697975411094835
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4165079337982117843}
|
||||
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: 0, y: 0}
|
||||
m_SizeDelta: {x: 40, y: 46}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &1344378821213387827
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4165079337982117843}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &7646980951699364853
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4165079337982117843}
|
||||
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: 08f5a0582a540a14a9c564a8628a35ac, type: 3}
|
||||
m_Type: 0
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
m_FillMethod: 4
|
||||
m_FillAmount: 1
|
||||
m_FillClockwise: 1
|
||||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
7
TheStrongestSnail/Assets/Resources/Egg.prefab.meta
Normal file
7
TheStrongestSnail/Assets/Resources/Egg.prefab.meta
Normal file
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5d62a65bec7f7b541862e2122c5ed2fc
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -137,6 +137,7 @@ GameObject:
|
||||
- component: {fileID: 20259221}
|
||||
- component: {fileID: 20259223}
|
||||
- component: {fileID: 20259224}
|
||||
- component: {fileID: 20259225}
|
||||
m_Layer: 5
|
||||
m_Name: Huang_Dou_House
|
||||
m_TagString: Untagged
|
||||
@ -325,8 +326,34 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: e73a82b9916cf6e4aa1d0ca68d99cb72, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
Money: 0
|
||||
Money: 1000
|
||||
PlayerNum: 0
|
||||
--- !u!114 &20259225
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 20259216}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 01c8157d35c35264ebea549f6ad275a7, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
Parent: {fileID: 1153582820}
|
||||
coinPrefab: {fileID: 4165079337982117843, guid: 5d62a65bec7f7b541862e2122c5ed2fc, type: 3}
|
||||
startPoint: {fileID: 20259217}
|
||||
targetPoints:
|
||||
- {fileID: 1049673027}
|
||||
- {fileID: 708679836}
|
||||
- {fileID: 715869100}
|
||||
- {fileID: 898215875}
|
||||
- {fileID: 2143530046}
|
||||
coinCount: 50
|
||||
spreadRadius: 50
|
||||
moveDuration: 1
|
||||
delayBetweenCoins: 0.1
|
||||
randomTargetRadius: 60
|
||||
--- !u!1 &43098354
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -3318,6 +3345,7 @@ GameObject:
|
||||
- component: {fileID: 708679842}
|
||||
- component: {fileID: 708679843}
|
||||
- component: {fileID: 708679844}
|
||||
- component: {fileID: 708679845}
|
||||
m_Layer: 5
|
||||
m_Name: Qing_Xi_House
|
||||
m_TagString: Untagged
|
||||
@ -3506,8 +3534,34 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: e73a82b9916cf6e4aa1d0ca68d99cb72, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
Money: 0
|
||||
Money: 1000
|
||||
PlayerNum: 0
|
||||
--- !u!114 &708679845
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 708679835}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 01c8157d35c35264ebea549f6ad275a7, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
Parent: {fileID: 1153582820}
|
||||
coinPrefab: {fileID: 4165079337982117843, guid: 5d62a65bec7f7b541862e2122c5ed2fc, type: 3}
|
||||
startPoint: {fileID: 708679836}
|
||||
targetPoints:
|
||||
- {fileID: 1049673027}
|
||||
- {fileID: 715869100}
|
||||
- {fileID: 20259217}
|
||||
- {fileID: 898215875}
|
||||
- {fileID: 2143530046}
|
||||
coinCount: 50
|
||||
spreadRadius: 50
|
||||
moveDuration: 1
|
||||
delayBetweenCoins: 0.1
|
||||
randomTargetRadius: 60
|
||||
--- !u!1 &715294074
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -3599,6 +3653,7 @@ GameObject:
|
||||
- component: {fileID: 715869104}
|
||||
- component: {fileID: 715869106}
|
||||
- component: {fileID: 715869107}
|
||||
- component: {fileID: 715869108}
|
||||
m_Layer: 5
|
||||
m_Name: Fen_Le_House
|
||||
m_TagString: Untagged
|
||||
@ -3787,8 +3842,34 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: e73a82b9916cf6e4aa1d0ca68d99cb72, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
Money: 0
|
||||
Money: 1000
|
||||
PlayerNum: 0
|
||||
--- !u!114 &715869108
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 715869099}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 01c8157d35c35264ebea549f6ad275a7, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
Parent: {fileID: 1153582820}
|
||||
coinPrefab: {fileID: 4165079337982117843, guid: 5d62a65bec7f7b541862e2122c5ed2fc, type: 3}
|
||||
startPoint: {fileID: 715869100}
|
||||
targetPoints:
|
||||
- {fileID: 1049673027}
|
||||
- {fileID: 708679836}
|
||||
- {fileID: 20259217}
|
||||
- {fileID: 898215875}
|
||||
- {fileID: 2143530046}
|
||||
coinCount: 50
|
||||
spreadRadius: 50
|
||||
moveDuration: 1
|
||||
delayBetweenCoins: 0.1
|
||||
randomTargetRadius: 60
|
||||
--- !u!1 &734040910
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -4556,6 +4637,7 @@ GameObject:
|
||||
- component: {fileID: 898215879}
|
||||
- component: {fileID: 898215881}
|
||||
- component: {fileID: 898215882}
|
||||
- component: {fileID: 898215883}
|
||||
m_Layer: 5
|
||||
m_Name: Lan_Xiao_House
|
||||
m_TagString: Untagged
|
||||
@ -4744,8 +4826,34 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: e73a82b9916cf6e4aa1d0ca68d99cb72, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
Money: 0
|
||||
Money: 1000
|
||||
PlayerNum: 0
|
||||
--- !u!114 &898215883
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 898215874}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 01c8157d35c35264ebea549f6ad275a7, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
Parent: {fileID: 1153582820}
|
||||
coinPrefab: {fileID: 4165079337982117843, guid: 5d62a65bec7f7b541862e2122c5ed2fc, type: 3}
|
||||
startPoint: {fileID: 898215875}
|
||||
targetPoints:
|
||||
- {fileID: 1049673027}
|
||||
- {fileID: 708679836}
|
||||
- {fileID: 20259217}
|
||||
- {fileID: 715869100}
|
||||
- {fileID: 2143530046}
|
||||
coinCount: 50
|
||||
spreadRadius: 50
|
||||
moveDuration: 1
|
||||
delayBetweenCoins: 0.1
|
||||
randomTargetRadius: 60
|
||||
--- !u!1 &935748550
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -4842,6 +4950,7 @@ MonoBehaviour:
|
||||
NumBtn: {fileID: 1954526986}
|
||||
BetText: {fileID: 251123273}
|
||||
BetValue: 0
|
||||
AllBetValue: 0
|
||||
BetButton: {fileID: 1227559357}
|
||||
text1: {fileID: 1099774253}
|
||||
text2: {fileID: 231143271}
|
||||
@ -4849,6 +4958,13 @@ MonoBehaviour:
|
||||
text4: {fileID: 1130954133}
|
||||
text5: {fileID: 364052607}
|
||||
text6: {fileID: 1057682373}
|
||||
list:
|
||||
- {fileID: 364052607}
|
||||
- {fileID: 1057682373}
|
||||
- {fileID: 1130954133}
|
||||
- {fileID: 1341881301}
|
||||
- {fileID: 1099774253}
|
||||
- {fileID: 231143271}
|
||||
--- !u!1 &1016365648
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -4959,6 +5075,7 @@ GameObject:
|
||||
- component: {fileID: 1049673033}
|
||||
- component: {fileID: 1049673034}
|
||||
- component: {fileID: 1049673035}
|
||||
- component: {fileID: 1049673036}
|
||||
m_Layer: 5
|
||||
m_Name: Purple_Monster_House
|
||||
m_TagString: Untagged
|
||||
@ -5147,8 +5264,34 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: e73a82b9916cf6e4aa1d0ca68d99cb72, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
Money: 10
|
||||
Money: 1000
|
||||
PlayerNum: 0
|
||||
--- !u!114 &1049673036
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1049673026}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 01c8157d35c35264ebea549f6ad275a7, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
Parent: {fileID: 1153582820}
|
||||
coinPrefab: {fileID: 4165079337982117843, guid: 5d62a65bec7f7b541862e2122c5ed2fc, type: 3}
|
||||
startPoint: {fileID: 1049673027}
|
||||
targetPoints:
|
||||
- {fileID: 708679836}
|
||||
- {fileID: 715869100}
|
||||
- {fileID: 20259217}
|
||||
- {fileID: 898215875}
|
||||
- {fileID: 2143530046}
|
||||
coinCount: 50
|
||||
spreadRadius: 50
|
||||
moveDuration: 1
|
||||
delayBetweenCoins: 0.1
|
||||
randomTargetRadius: 60
|
||||
--- !u!1 &1057682373 stripped
|
||||
GameObject:
|
||||
m_CorrespondingSourceObject: {fileID: 4075030775632783691, guid: a030fef0719b2504ba325e558ca3651c, type: 3}
|
||||
@ -8984,6 +9127,7 @@ MonoBehaviour:
|
||||
StartPos: {fileID: 286275319}
|
||||
BossAni: {fileID: 1790882393}
|
||||
IsLeft: 0
|
||||
HouseId: 0
|
||||
--- !u!114 &1790882392
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -10468,6 +10612,7 @@ GameObject:
|
||||
- component: {fileID: 2143530050}
|
||||
- component: {fileID: 2143530052}
|
||||
- component: {fileID: 2143530053}
|
||||
- component: {fileID: 2143530054}
|
||||
m_Layer: 5
|
||||
m_Name: Lu_Qu_House
|
||||
m_TagString: Untagged
|
||||
@ -10656,8 +10801,34 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: e73a82b9916cf6e4aa1d0ca68d99cb72, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
Money: 0
|
||||
Money: 1000
|
||||
PlayerNum: 0
|
||||
--- !u!114 &2143530054
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2143530045}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 01c8157d35c35264ebea549f6ad275a7, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
Parent: {fileID: 1153582820}
|
||||
coinPrefab: {fileID: 4165079337982117843, guid: 5d62a65bec7f7b541862e2122c5ed2fc, type: 3}
|
||||
startPoint: {fileID: 2143530046}
|
||||
targetPoints:
|
||||
- {fileID: 1049673027}
|
||||
- {fileID: 708679836}
|
||||
- {fileID: 715869100}
|
||||
- {fileID: 20259217}
|
||||
- {fileID: 898215875}
|
||||
coinCount: 50
|
||||
spreadRadius: 50
|
||||
moveDuration: 1
|
||||
delayBetweenCoins: 0.1
|
||||
randomTargetRadius: 60
|
||||
--- !u!1 &2143809076
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -5,10 +5,12 @@ using UnityEngine.UI;
|
||||
|
||||
public class BettingBtn : MonoBehaviour
|
||||
{
|
||||
public static BettingBtn instance;
|
||||
public GameObject BetList;
|
||||
public Button NumBtn;
|
||||
public Text BetText;
|
||||
public float BetValue;//ͶעµÄÖµ
|
||||
public float AllBetValue;//Ͷע×ÜÖµ
|
||||
|
||||
public Button BetButton;//ͶעµÄ°´Å¥
|
||||
|
||||
@ -18,9 +20,14 @@ public class BettingBtn : MonoBehaviour
|
||||
public GameObject text4;
|
||||
public GameObject text5;
|
||||
public GameObject text6;
|
||||
|
||||
|
||||
|
||||
public List<GameObject> list=new List<GameObject>();
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
instance = this;
|
||||
BetList.SetActive(false);
|
||||
NumBtn.onClick.AddListener(OnClickNumBtn);
|
||||
BetButton.onClick.AddListener(OnClickBetBtn);
|
||||
@ -44,36 +51,43 @@ public class BettingBtn : MonoBehaviour
|
||||
if (PlayerInfo.instance.SetMoney(-BetValue))
|
||||
{
|
||||
text1.GetComponent<TextBox>().SetText(BetValue);
|
||||
AllBetValue += BetValue;
|
||||
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (PlayerInfo.instance.SetMoney(-BetValue))
|
||||
{
|
||||
text2.GetComponent<TextBox>().SetText(BetValue);
|
||||
AllBetValue += BetValue;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
if (PlayerInfo.instance.SetMoney(-BetValue))
|
||||
{
|
||||
text3.GetComponent<TextBox>().SetText(BetValue);
|
||||
AllBetValue += BetValue;
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
if (PlayerInfo.instance.SetMoney(-BetValue))
|
||||
{
|
||||
text4.GetComponent<TextBox>().SetText(BetValue);
|
||||
AllBetValue += BetValue;
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
if (PlayerInfo.instance.SetMoney(-BetValue))
|
||||
{
|
||||
text5.GetComponent<TextBox>().SetText(BetValue);
|
||||
AllBetValue += BetValue;
|
||||
}
|
||||
break;
|
||||
case 6:
|
||||
if (PlayerInfo.instance.SetMoney(-BetValue))
|
||||
{
|
||||
text6.GetComponent<TextBox>().SetText(BetValue);
|
||||
AllBetValue += BetValue;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@ -106,5 +120,90 @@ public class BettingBtn : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void GiveMoney()
|
||||
{
|
||||
float AllMoney = text1.GetComponent<TextBox>().ReturnText() + text2.GetComponent<TextBox>().ReturnText() + text3.GetComponent<TextBox>().ReturnText()
|
||||
+ text4.GetComponent<TextBox>().ReturnText() + text5.GetComponent<TextBox>().ReturnText() + text6.GetComponent<TextBox>().ReturnText();
|
||||
|
||||
|
||||
|
||||
switch (BossContro.instance.HouseId)
|
||||
{
|
||||
case 1:
|
||||
text1.GetComponent<TextBox>().PlayAni();
|
||||
ControMoney(text1);
|
||||
break;
|
||||
case 2:
|
||||
text2.GetComponent<TextBox>().PlayAni();
|
||||
ControMoney(text2);
|
||||
break;
|
||||
case 3:
|
||||
text3.GetComponent<TextBox>().PlayAni();
|
||||
ControMoney(text3);
|
||||
break;
|
||||
case 4:
|
||||
text4.GetComponent<TextBox>().PlayAni();
|
||||
ControMoney(text4);
|
||||
break;
|
||||
case 5:
|
||||
text5.GetComponent<TextBox>().PlayAni();
|
||||
ControMoney(text5);
|
||||
break;
|
||||
case 6:
|
||||
text6.GetComponent<TextBox>().PlayAni();
|
||||
ControMoney(text6);
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void ControMoney(GameObject text)
|
||||
{
|
||||
float giveMoney= text.GetComponent<TextBox>().ReturnText();
|
||||
text.GetComponent<TextBox>().SetText(-giveMoney);
|
||||
|
||||
float AllMoney = text1.GetComponent<TextBox>().ReturnText() + text2.GetComponent<TextBox>().ReturnText() + text3.GetComponent<TextBox>().ReturnText()
|
||||
+ text4.GetComponent<TextBox>().ReturnText() + text5.GetComponent<TextBox>().ReturnText() + text6.GetComponent<TextBox>().ReturnText();
|
||||
|
||||
for (int i=0;i<list.Count;i++)
|
||||
{
|
||||
if (list[i]==text)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
list[i].GetComponent<TextBox>().SetText(giveMoney*(list[i].GetComponent<TextBox>().ReturnText()/AllMoney));
|
||||
}
|
||||
}
|
||||
|
||||
public void GiveMoneyToPlayer()
|
||||
{
|
||||
switch (PlayerMovePos.instance.HouseId)
|
||||
{
|
||||
case 1:
|
||||
PlayerInfo.instance.SetMoney(text1.GetComponent<TextBox>().ReturnText()/2);
|
||||
|
||||
break;
|
||||
case 2:
|
||||
PlayerInfo.instance.SetMoney(text2.GetComponent<TextBox>().ReturnText()/2);
|
||||
break;
|
||||
case 3:
|
||||
PlayerInfo.instance.SetMoney(text3.GetComponent<TextBox>().ReturnText() / 2);
|
||||
break;
|
||||
case 4:
|
||||
PlayerInfo.instance.SetMoney(text4.GetComponent<TextBox>().ReturnText()/2);
|
||||
break;
|
||||
case 5:
|
||||
PlayerInfo.instance.SetMoney(text5.GetComponent<TextBox>().ReturnText() / 2);
|
||||
break;
|
||||
case 6:
|
||||
PlayerInfo.instance.SetMoney(text6.GetComponent<TextBox>().ReturnText() / 2);
|
||||
break;
|
||||
default:
|
||||
Debug.Log("δѡÔñ·¿¼ä");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -13,6 +13,7 @@ public class BossContro : MonoBehaviour
|
||||
|
||||
public Animator BossAni;//boos动画
|
||||
public bool IsLeft;
|
||||
public int HouseId;//·¿¼ä±àºÅ
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
@ -11,10 +11,11 @@ public class EggNum : MonoBehaviour
|
||||
void Start()
|
||||
{
|
||||
instance = this;
|
||||
|
||||
}
|
||||
public void SetEggNumText()
|
||||
public void SetEggNumText(float start)
|
||||
{
|
||||
eggNumText.text = PlayerInfo.instance.Money.ToString();
|
||||
StartCoroutine(Tools.AnimateText(start, PlayerInfo.instance.Money, 0.5f,eggNumText));
|
||||
}
|
||||
|
||||
}
|
||||
|
106
TheStrongestSnail/Assets/Scripts/Battle_Royale/MoneyAnimation.cs
Normal file
106
TheStrongestSnail/Assets/Scripts/Battle_Royale/MoneyAnimation.cs
Normal file
@ -0,0 +1,106 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using DG.Tweening;
|
||||
|
||||
public class MoneyAnimation : MonoBehaviour
|
||||
{
|
||||
public Transform Parent; // 设置父节点,调高层级,避免被其他UI遮挡
|
||||
public GameObject coinPrefab; // 金币的预制体
|
||||
public Transform startPoint; // 金币生成的起点(例如箱子的位置)
|
||||
public Transform[] targetPoints; // 目标点数组(例如 5 个目标点)
|
||||
public int coinCount; // 生成的金币数量
|
||||
public float spreadRadius; // 金币生成时的随机扩散半径
|
||||
public float moveDuration; // 金币移动到目标点的时间
|
||||
public float delayBetweenCoins; // 每个金币延迟启动的时间间隔
|
||||
public float randomTargetRadius; // 每个金币到达目标点时,周围随机偏移的半径
|
||||
|
||||
private List<GameObject> coins = new List<GameObject>();
|
||||
|
||||
private void Start()
|
||||
{
|
||||
// 初始化工作(如果有需要)
|
||||
}
|
||||
|
||||
public void PlayCoinAnimation()
|
||||
{
|
||||
int completedCount = 0; // 记录已经完成动画的金币数量
|
||||
|
||||
// 确保目标点数组有至少 1 个元素
|
||||
if (targetPoints.Length == 0)
|
||||
{
|
||||
Debug.LogError("没有设置目标点!");
|
||||
return;
|
||||
}
|
||||
|
||||
// 生成所有金币
|
||||
for (int i = 0; i < coinCount; i++)
|
||||
{
|
||||
// 在起点附近生成金币
|
||||
Vector3 randomOffset = new Vector3(
|
||||
Random.Range(-spreadRadius, spreadRadius),
|
||||
Random.Range(-spreadRadius, spreadRadius),
|
||||
0);
|
||||
GameObject coin = Instantiate(coinPrefab, startPoint.position + randomOffset, Quaternion.identity, Parent);
|
||||
coins.Add(coin);
|
||||
}
|
||||
|
||||
// 将金币分配到目标点,每个目标点分配相同数量的金币
|
||||
int coinsPerTarget = coinCount / targetPoints.Length;
|
||||
List<List<GameObject>> groups = new List<List<GameObject>>();
|
||||
|
||||
// 将金币分配到每个目标点
|
||||
int coinIndex = 0;
|
||||
for (int i = 0; i < targetPoints.Length; i++)
|
||||
{
|
||||
List<GameObject> group = new List<GameObject>();
|
||||
for (int j = 0; j < coinsPerTarget; j++)
|
||||
{
|
||||
if (coinIndex < coinCount)
|
||||
{
|
||||
group.Add(coins[coinIndex]);
|
||||
coinIndex++;
|
||||
}
|
||||
}
|
||||
groups.Add(group);
|
||||
}
|
||||
|
||||
// 对于每个目标点,逐个动画地将每组金币移动到目标点
|
||||
for (int i = 0; i < targetPoints.Length; i++)
|
||||
{
|
||||
Transform targetPoint = targetPoints[i];
|
||||
List<GameObject> group = groups[i];
|
||||
|
||||
// 为每组金币启动逐个动画
|
||||
for (int j = 0; j < group.Count; j++)
|
||||
{
|
||||
GameObject coin = group[j];
|
||||
|
||||
// 计算延迟时间,稍微增加一点间隔
|
||||
float delay = j * delayBetweenCoins; // 每个金币的延迟
|
||||
|
||||
// 在目标点附近生成一个随机位置
|
||||
Vector3 randomTargetPosition = targetPoint.position + new Vector3(
|
||||
Random.Range(-randomTargetRadius, randomTargetRadius),
|
||||
Random.Range(-randomTargetRadius, randomTargetRadius),
|
||||
0);
|
||||
|
||||
// 使用 DOTween 移动金币到随机的目标点附近
|
||||
coin.transform.DOMove(randomTargetPosition, moveDuration)
|
||||
.SetDelay(delay) // 只有延迟,但不需要等前一个金币完成
|
||||
.SetEase(Ease.InOutQuad) // 设置缓动类型
|
||||
.OnComplete(() =>
|
||||
{
|
||||
completedCount++;
|
||||
Destroy(coin); // 动画完成后销毁金币
|
||||
|
||||
// 当所有金币都完成动画时,执行其他操作
|
||||
if (completedCount == coinCount)
|
||||
{
|
||||
// 在所有金币完成后执行你需要的操作,比如:
|
||||
// BettingBtn.instance.GiveMoney();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 01c8157d35c35264ebea549f6ad275a7
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,18 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class MoneyContro : MonoBehaviour
|
||||
{
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: af942b734b370ac47884f9d4388aa474
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -11,14 +11,16 @@ public class PlayerInfo : MonoBehaviour
|
||||
void Start()
|
||||
{
|
||||
instance = this;
|
||||
EggNum.instance.eggNumText.text=Money.ToString();
|
||||
}
|
||||
|
||||
public bool SetMoney(float add)
|
||||
{
|
||||
if (Money+add>=0)
|
||||
{
|
||||
float start = Money;
|
||||
Money += add;
|
||||
EggNum.instance.SetEggNumText();
|
||||
EggNum.instance.SetEggNumText(start);
|
||||
return true;
|
||||
}
|
||||
Debug.Log("钱不够");
|
||||
|
@ -70,6 +70,10 @@ public class PlayerMove : MonoBehaviour
|
||||
{
|
||||
PlayerMovePos.instance.HouseId = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
BossContro.instance.HouseId = 1;
|
||||
}
|
||||
}
|
||||
else if (EndPos == TypeEndPos2)
|
||||
{
|
||||
@ -79,6 +83,10 @@ public class PlayerMove : MonoBehaviour
|
||||
{
|
||||
PlayerMovePos.instance.HouseId = 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
BossContro.instance.HouseId = 2;
|
||||
}
|
||||
}
|
||||
else if(EndPos == TypeEndPos3)
|
||||
{
|
||||
@ -87,6 +95,10 @@ public class PlayerMove : MonoBehaviour
|
||||
{
|
||||
PlayerMovePos.instance.HouseId = 3;
|
||||
}
|
||||
else
|
||||
{
|
||||
BossContro.instance.HouseId = 3;
|
||||
}
|
||||
}
|
||||
else if (EndPos == TypeEndPos4)
|
||||
{
|
||||
@ -95,6 +107,10 @@ public class PlayerMove : MonoBehaviour
|
||||
{
|
||||
PlayerMovePos.instance.HouseId = 4;
|
||||
}
|
||||
else
|
||||
{
|
||||
BossContro.instance.HouseId = 4;
|
||||
}
|
||||
}
|
||||
else if (EndPos == TypeEndPos5)
|
||||
{
|
||||
@ -103,6 +119,10 @@ public class PlayerMove : MonoBehaviour
|
||||
{
|
||||
PlayerMovePos.instance.HouseId = 5;
|
||||
}
|
||||
else
|
||||
{
|
||||
BossContro.instance.HouseId = 5;
|
||||
}
|
||||
}
|
||||
else if (EndPos == TypeEndPos6)
|
||||
{
|
||||
@ -111,6 +131,10 @@ public class PlayerMove : MonoBehaviour
|
||||
{
|
||||
PlayerMovePos.instance.HouseId = 6;
|
||||
}
|
||||
else
|
||||
{
|
||||
BossContro.instance.HouseId = 6;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -251,6 +275,9 @@ public class PlayerMove : MonoBehaviour
|
||||
BossContro.instance.BossAni.SetInteger("State", 2);
|
||||
yield return new WaitForSeconds(3f);
|
||||
BossContro.instance.BossAni.SetInteger("State", 0);
|
||||
|
||||
BettingBtn.instance.GiveMoney();
|
||||
yield return new WaitForSeconds(2f);
|
||||
JudgeSuccOrFail();
|
||||
}
|
||||
|
||||
|
@ -18,7 +18,20 @@ public class TextBox : MonoBehaviour
|
||||
|
||||
public void SetText(float add)
|
||||
{
|
||||
float start = ParentHouse.GetComponent<HouseInfo>().Money;
|
||||
ParentHouse.GetComponent<HouseInfo>().Money += add;
|
||||
numText.text = ParentHouse.GetComponent<HouseInfo>().Money.ToString();
|
||||
|
||||
StartCoroutine(Tools.AnimateText(start, ParentHouse.GetComponent<HouseInfo>().Money,0.5f,numText));
|
||||
}
|
||||
|
||||
|
||||
public float ReturnText()
|
||||
{
|
||||
return ParentHouse.GetComponent<HouseInfo>().Money;
|
||||
}
|
||||
|
||||
public void PlayAni()
|
||||
{
|
||||
ParentHouse.GetComponent<MoneyAnimation>().PlayCoinAnimation();
|
||||
}
|
||||
}
|
||||
|
38
TheStrongestSnail/Assets/Scripts/Battle_Royale/Tools.cs
Normal file
38
TheStrongestSnail/Assets/Scripts/Battle_Royale/Tools.cs
Normal file
@ -0,0 +1,38 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
public class Tools : MonoBehaviour
|
||||
{
|
||||
// Start is called before the first frame update
|
||||
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
public static IEnumerator AnimateText(float startValue, float endValue, float time, Text SetText)
|
||||
{
|
||||
float elapsedTime = 0f; // 已经过去的时间
|
||||
while (elapsedTime < time)
|
||||
{
|
||||
elapsedTime += Time.deltaTime;
|
||||
float t = elapsedTime / time;
|
||||
|
||||
// 计算当前值,使用 Mathf.Lerp 进行线性插值
|
||||
int currentValue = Mathf.RoundToInt(Mathf.Lerp(startValue, endValue, t));
|
||||
|
||||
// 更新文本显示
|
||||
SetText.text = currentValue.ToString();
|
||||
|
||||
yield return null; // 等待一帧
|
||||
}
|
||||
|
||||
SetText.text = endValue.ToString();
|
||||
|
||||
}
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
11
TheStrongestSnail/Assets/Scripts/Battle_Royale/Tools.cs.meta
Normal file
11
TheStrongestSnail/Assets/Scripts/Battle_Royale/Tools.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 015e7df3e26db8d478a224bd7325d49b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Loading…
Reference in New Issue
Block a user