This commit is contained in:
五条悟 2024-11-13 21:54:40 +08:00
commit 5c5ef898f8
30 changed files with 2180 additions and 71 deletions

View File

@ -1,5 +1,105 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1101 &-7934733917320206733
AnimatorStateTransition:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name:
m_Conditions:
- m_ConditionMode: 6
m_ConditionEvent: State
m_EventTreshold: 1
m_DstStateMachine: {fileID: 0}
m_DstState: {fileID: -1701036716963345556}
m_Solo: 0
m_Mute: 0
m_IsExit: 0
serializedVersion: 3
m_TransitionDuration: 0
m_TransitionOffset: 0
m_ExitTime: 0.7222222
m_HasExitTime: 0
m_HasFixedDuration: 1
m_InterruptionSource: 0
m_OrderedInterruption: 1
m_CanTransitionToSelf: 1
--- !u!1101 &-5960863943501419562
AnimatorStateTransition:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name:
m_Conditions:
- m_ConditionMode: 6
m_ConditionEvent: State
m_EventTreshold: 0
m_DstStateMachine: {fileID: 0}
m_DstState: {fileID: -2708652100068900557}
m_Solo: 0
m_Mute: 0
m_IsExit: 0
serializedVersion: 3
m_TransitionDuration: 0
m_TransitionOffset: 0
m_ExitTime: 0.7222222
m_HasExitTime: 0
m_HasFixedDuration: 1
m_InterruptionSource: 0
m_OrderedInterruption: 1
m_CanTransitionToSelf: 1
--- !u!1101 &-5934605492820383976
AnimatorStateTransition:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name:
m_Conditions:
- m_ConditionMode: 6
m_ConditionEvent: State
m_EventTreshold: 2
m_DstStateMachine: {fileID: 0}
m_DstState: {fileID: 6137305484940752271}
m_Solo: 0
m_Mute: 0
m_IsExit: 0
serializedVersion: 3
m_TransitionDuration: 0
m_TransitionOffset: 0
m_ExitTime: 0.7222222
m_HasExitTime: 0
m_HasFixedDuration: 1
m_InterruptionSource: 0
m_OrderedInterruption: 1
m_CanTransitionToSelf: 1
--- !u!1101 &-5234480481874143179
AnimatorStateTransition:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name:
m_Conditions:
- m_ConditionMode: 6
m_ConditionEvent: State
m_EventTreshold: 2
m_DstStateMachine: {fileID: 0}
m_DstState: {fileID: 6137305484940752271}
m_Solo: 0
m_Mute: 0
m_IsExit: 0
serializedVersion: 3
m_TransitionDuration: 0
m_TransitionOffset: 0
m_ExitTime: 0.7222222
m_HasExitTime: 0
m_HasFixedDuration: 1
m_InterruptionSource: 0
m_OrderedInterruption: 1
m_CanTransitionToSelf: 1
--- !u!1102 &-2708652100068900557
AnimatorState:
serializedVersion: 6
@ -10,7 +110,9 @@ AnimatorState:
m_Name: Boos_Stand_1
m_Speed: 1
m_CycleOffset: 0
m_Transitions: []
m_Transitions:
- {fileID: -7934733917320206733}
- {fileID: -5934605492820383976}
m_StateMachineBehaviours: []
m_Position: {x: 50, y: 50, z: 0}
m_IKOnFeet: 0
@ -36,7 +138,9 @@ AnimatorState:
m_Name: Boss_Move_1
m_Speed: 1
m_CycleOffset: 0
m_Transitions: []
m_Transitions:
- {fileID: -5234480481874143179}
- {fileID: -5960863943501419562}
m_StateMachineBehaviours: []
m_Position: {x: 50, y: 50, z: 0}
m_IKOnFeet: 0
@ -60,7 +164,13 @@ AnimatorController:
m_PrefabAsset: {fileID: 0}
m_Name: boss
serializedVersion: 5
m_AnimatorParameters: []
m_AnimatorParameters:
- m_Name: State
m_Type: 3
m_DefaultFloat: 0
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 9100000}
m_AnimatorLayers:
- serializedVersion: 5
m_Name: Base Layer
@ -74,6 +184,31 @@ AnimatorController:
m_IKPass: 0
m_SyncedLayerAffectsTiming: 0
m_Controller: {fileID: 9100000}
--- !u!1101 &2102501988603932205
AnimatorStateTransition:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name:
m_Conditions:
- m_ConditionMode: 6
m_ConditionEvent: State
m_EventTreshold: 1
m_DstStateMachine: {fileID: 0}
m_DstState: {fileID: -1701036716963345556}
m_Solo: 0
m_Mute: 0
m_IsExit: 0
serializedVersion: 3
m_TransitionDuration: 0
m_TransitionOffset: 0
m_ExitTime: 0.7794118
m_HasExitTime: 0
m_HasFixedDuration: 1
m_InterruptionSource: 0
m_OrderedInterruption: 1
m_CanTransitionToSelf: 1
--- !u!1107 &4854017570470400453
AnimatorStateMachine:
serializedVersion: 6
@ -85,20 +220,20 @@ AnimatorStateMachine:
m_ChildStates:
- serializedVersion: 1
m_State: {fileID: -2708652100068900557}
m_Position: {x: 280, y: 180, z: 0}
m_Position: {x: 300, y: 40, z: 0}
- serializedVersion: 1
m_State: {fileID: 6137305484940752271}
m_Position: {x: 270, y: 250, z: 0}
m_Position: {x: 440, y: 250, z: 0}
- serializedVersion: 1
m_State: {fileID: -1701036716963345556}
m_Position: {x: 270, y: 130, z: 0}
m_Position: {x: 580, y: 50, z: 0}
m_ChildStateMachines: []
m_AnyStateTransitions: []
m_EntryTransitions: []
m_StateMachineTransitions: {}
m_StateMachineBehaviours: []
m_AnyStatePosition: {x: 50, y: 20, z: 0}
m_EntryPosition: {x: 50, y: 120, z: 0}
m_EntryPosition: {x: 50, y: 110, z: 0}
m_ExitPosition: {x: 800, y: 120, z: 0}
m_ParentStateMachinePosition: {x: 800, y: 20, z: 0}
m_DefaultState: {fileID: -2708652100068900557}
@ -112,7 +247,9 @@ AnimatorState:
m_Name: Boss_Attak_1
m_Speed: 1
m_CycleOffset: 0
m_Transitions: []
m_Transitions:
- {fileID: 2102501988603932205}
- {fileID: 6696194820416691433}
m_StateMachineBehaviours: []
m_Position: {x: 50, y: 50, z: 0}
m_IKOnFeet: 0
@ -128,3 +265,28 @@ AnimatorState:
m_MirrorParameter:
m_CycleOffsetParameter:
m_TimeParameter:
--- !u!1101 &6696194820416691433
AnimatorStateTransition:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name:
m_Conditions:
- m_ConditionMode: 6
m_ConditionEvent: State
m_EventTreshold: 0
m_DstStateMachine: {fileID: 0}
m_DstState: {fileID: -2708652100068900557}
m_Solo: 0
m_Mute: 0
m_IsExit: 0
serializedVersion: 3
m_TransitionDuration: 0
m_TransitionOffset: 0
m_ExitTime: 0.7794118
m_HasExitTime: 0
m_HasFixedDuration: 1
m_InterruptionSource: 0
m_OrderedInterruption: 1
m_CanTransitionToSelf: 1

View File

@ -10,7 +10,8 @@ AnimatorState:
m_Name: WoniuMove
m_Speed: 1
m_CycleOffset: 0
m_Transitions: []
m_Transitions:
- {fileID: 1384410484589089456}
m_StateMachineBehaviours: []
m_Position: {x: 50, y: 50, z: 0}
m_IKOnFeet: 0
@ -37,7 +38,7 @@ AnimatorStateMachine:
m_ChildStates:
- serializedVersion: 1
m_State: {fileID: -3564240249193308846}
m_Position: {x: 320, y: 200, z: 0}
m_Position: {x: 320, y: 140, z: 0}
- serializedVersion: 1
m_State: {fileID: 7113374065487982496}
m_Position: {x: 320, y: 40, z: 0}
@ -59,7 +60,13 @@ AnimatorController:
m_PrefabAsset: {fileID: 0}
m_Name: snail_10
serializedVersion: 5
m_AnimatorParameters: []
m_AnimatorParameters:
- m_Name: State
m_Type: 3
m_DefaultFloat: 0
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 9100000}
m_AnimatorLayers:
- serializedVersion: 5
m_Name: Base Layer
@ -73,6 +80,56 @@ AnimatorController:
m_IKPass: 0
m_SyncedLayerAffectsTiming: 0
m_Controller: {fileID: 9100000}
--- !u!1101 &1384410484589089456
AnimatorStateTransition:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name:
m_Conditions:
- m_ConditionMode: 6
m_ConditionEvent: State
m_EventTreshold: 0
m_DstStateMachine: {fileID: 0}
m_DstState: {fileID: 7113374065487982496}
m_Solo: 0
m_Mute: 0
m_IsExit: 0
serializedVersion: 3
m_TransitionDuration: 0
m_TransitionOffset: 0
m_ExitTime: 0.75
m_HasExitTime: 0
m_HasFixedDuration: 1
m_InterruptionSource: 0
m_OrderedInterruption: 1
m_CanTransitionToSelf: 1
--- !u!1101 &6879221536656622820
AnimatorStateTransition:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name:
m_Conditions:
- m_ConditionMode: 6
m_ConditionEvent: State
m_EventTreshold: 1
m_DstStateMachine: {fileID: 0}
m_DstState: {fileID: -3564240249193308846}
m_Solo: 0
m_Mute: 0
m_IsExit: 0
serializedVersion: 3
m_TransitionDuration: 0
m_TransitionOffset: 0
m_ExitTime: 0.625
m_HasExitTime: 0
m_HasFixedDuration: 1
m_InterruptionSource: 0
m_OrderedInterruption: 1
m_CanTransitionToSelf: 1
--- !u!1102 &7113374065487982496
AnimatorState:
serializedVersion: 6
@ -83,7 +140,8 @@ AnimatorState:
m_Name: snail_Stand_1
m_Speed: 1
m_CycleOffset: 0
m_Transitions: []
m_Transitions:
- {fileID: 6879221536656622820}
m_StateMachineBehaviours: []
m_Position: {x: 50, y: 50, z: 0}
m_IKOnFeet: 0

View 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

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 5d62a65bec7f7b541862e2122c5ed2fc
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -236,7 +236,7 @@ MonoBehaviour:
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_Maskable: 0
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []

File diff suppressed because it is too large Load Diff

View File

@ -5,15 +5,32 @@ 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;//投注的按钮
public GameObject text1;
public GameObject text2;
public GameObject text3;
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);
BetValue = 50;//默认50
SetBet();
}
@ -24,7 +41,70 @@ public class BettingBtn : MonoBehaviour
}
void SetBet()
void OnClickBetBtn()
{
if (HegemonTime.instance.timeNum>20)
{
switch (PlayerMovePos.instance.HouseId)
{
case 1:
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:
Debug.Log("请选择房间");
break;
}
}
else
{
Debug.Log("现在无法投注");
}
}
void SetBet()
{
// 获取所有的Button组件
Button[] buttons = BetList.GetComponentsInChildren<Button>();
@ -40,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;
}
}
}

View File

@ -0,0 +1,18 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class BoosState : MonoBehaviour
{
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: cfec5867e4a7d1d46a439b42e59e401b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -10,6 +10,10 @@ public class BossContro : MonoBehaviour
public Transform BoosStartPos;
public static BossContro instance;
public Transform StartPos;
public Animator BossAni;//boos动画
public bool IsLeft;
public int HouseId;//房间编号
// Start is called before the first frame update
void Start()
{
@ -35,8 +39,11 @@ public class BossContro : MonoBehaviour
// 需要时将 childObject 移回原始父物体,并设置为第一个子节点
transform.SetParent(originalParent);
transform.SetAsFirstSibling(); // 设置为第一个子节点
transform.position= StartPos.position;
BoosStartPos=StartPos;
}
public void BossMove()
@ -64,6 +71,7 @@ public class BossContro : MonoBehaviour
break;
}
//MoveParent();
BossAni.SetInteger("State", 1);//动画转为移动
GetComponent<PlayerMove>().StartMove();
}
}

View File

@ -0,0 +1,21 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class EggNum : MonoBehaviour
{
public Text eggNumText;
public static EggNum instance;
// Start is called before the first frame update
void Start()
{
instance = this;
}
public void SetEggNumText(float start)
{
StartCoroutine(Tools.AnimateText(start, PlayerInfo.instance.Money, 0.5f,eggNumText));
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: d25eb7dd60c5c5b4ebe92cb619fd9381
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -27,7 +27,12 @@ public class FailPanel : BasePanel
base.HidePanel();
PlayerMovePos.instance.IsReturn = true;
BossContro.instance.ReturnParent();
MaskContro.instance.SetMask(false);
//都返回原来的位置
}
public override void ShowPanel()
{
base.ShowPanel();
BossContro.instance.ReturnParent();
}
}

View File

@ -31,10 +31,16 @@ public class HegemonTime : MonoBehaviour
timeText.text = (timeNum-carrySeconds).ToString(); // 显示整数秒数
yield return new WaitForSeconds(1f); // 等待1秒
timeNum -= 1;
if (timeNum<=20)
{
MaskContro.instance.SetMask(true);
}
}
timeNum = 60;
Debug.Log("Boos来了");
BossContro.instance.BossMove();
timeNum = 60;
}
}

View File

@ -20,7 +20,7 @@ public class HouseBtn : MonoBehaviour
Debug.Log("点击");
transform.GetComponent<PlayerMove>().StartMove();
PlayerMovePos.instance.HadChoise=true;
MaskContro.instance.SetMask(true);
}
}

View File

@ -0,0 +1,20 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class HouseInfo : MonoBehaviour
{
public float Money;
public int PlayerNum;//Íæ¼ÒÊýÁ¿
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e73a82b9916cf6e4aa1d0ca68d99cb72
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View 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();
}
});
}
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 01c8157d35c35264ebea549f6ad275a7
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -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()
{
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: af942b734b370ac47884f9d4388aa474
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,36 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerInfo : MonoBehaviour
{
public static PlayerInfo instance;
public float Money = 1000;
// Start is called before the first frame update
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(start);
return true;
}
Debug.Log("Ç®²»¹»");
return false;
}
// Update is called once per frame
void Update()
{
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 0bf4875777bb5b54a9371f68bfd12725
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -66,27 +66,75 @@ public class PlayerMove : MonoBehaviour
if (EndPos == TypeEndPos1)
{
MoveInParent(Pos1Parent);
if (!IsBoos)
{
PlayerMovePos.instance.HouseId = 1;
}
else
{
BossContro.instance.HouseId = 1;
}
}
else if (EndPos == TypeEndPos2)
{
MoveInParent(Pos2Parent);
if (!IsBoos)
{
PlayerMovePos.instance.HouseId = 2;
}
else
{
BossContro.instance.HouseId = 2;
}
}
else if(EndPos == TypeEndPos3)
{
MoveInParent(Pos3Parent);
if (!IsBoos)
{
PlayerMovePos.instance.HouseId = 3;
}
else
{
BossContro.instance.HouseId = 3;
}
}
else if (EndPos == TypeEndPos4)
{
MoveInParent(Pos4Parent);
if (!IsBoos)
{
PlayerMovePos.instance.HouseId = 4;
}
else
{
BossContro.instance.HouseId = 4;
}
}
else if (EndPos == TypeEndPos5)
{
MoveInParent(Pos5Parent);
if (!IsBoos)
{
PlayerMovePos.instance.HouseId = 5;
}
else
{
BossContro.instance.HouseId = 5;
}
}
else if (EndPos == TypeEndPos6)
{
MoveInParent(Pos6Parent);
if (!IsBoos)
{
PlayerMovePos.instance.HouseId = 6;
}
else
{
BossContro.instance.HouseId = 6;
}
}
@ -182,62 +230,137 @@ public class PlayerMove : MonoBehaviour
public void AfterMove()
{
if (!IsBoos)
{
PlayerMovePos.instance.StartPos =EndPos;
Debug.Log("修改StartPos值" + PlayerMovePos.instance.StartPos);
}
else
{
BossContro.instance.BoosStartPos=EndPos;
Debug.Log("修改BossPos值" + BossContro.instance.BoosStartPos);
if (BossContro.instance.BoosStartPos==PlayerMovePos.instance.StartPos&& PlayerMovePos.instance.HadChoise)
{
Debug.Log("失败");//失败
FailPanel.instance.ShowPanel();
}
else if(BossContro.instance.BoosStartPos != PlayerMovePos.instance.StartPos && PlayerMovePos.instance.HadChoise)
{
Debug.Log("胜利");//胜利
SucceePanel.instance.ShowPanel();
}
else
{
Debug.Log("没有失败和胜利");//胜利
}
HegemonTime.instance.StartCoroutine(HegemonTime.instance.StartGame());//重新计算时间
}
if (!PlayerMovePos.instance.IsReturn)
{
objectToMove.DOMoveY(objectToMove.position.y + 100, 0.5f).OnComplete(()=>{
JudgeEnd();
if (!IsBoos) { MaskContro.instance.SetMask(false);}
if (!IsBoos)
{
PlayerMovePos.instance.StartPos = EndPos;
PlayerMovePos.instance.PlayAni.SetInteger("State",0);
MaskContro.instance.SetMask(false);
}
else
{
//BossContro.instance.BossAni.SetInteger("State", 0);//停止移动
StartCoroutine(BoosAttack());
BossContro.instance.BoosStartPos = EndPos;
//JudgeSuccOrFail();
}
});
}
else
{
PlayerMovePos.instance.IsReturn = false;//ÖØÖÃ
MaskContro.instance.SetMask(false);
}
}
IEnumerator BoosAttack()
{
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();
}
public void JudgeSuccOrFail()
{
if (BossContro.instance.BoosStartPos == PlayerMovePos.instance.StartPos && PlayerMovePos.instance.HadChoise)
{
//BossContro.instance.BossAni.SetInteger("State", 2);//boos攻击
Debug.Log("失败");//失败
FailPanel.instance.ShowPanel();
}
else if (BossContro.instance.BoosStartPos != PlayerMovePos.instance.StartPos && PlayerMovePos.instance.HadChoise)
{
Debug.Log("胜利");//胜利
SucceePanel.instance.ShowPanel();
}
else
{
Debug.Log("没有失败和胜利");//胜利
}
HegemonTime.instance.StartCoroutine(HegemonTime.instance.StartGame());//重新计算时间
}
public void Rotate()
{
Vector3 currentRotation = objectToMove.localEulerAngles;
currentRotation.y += 180f;
objectToMove.localEulerAngles = currentRotation;
}
public void OnMove(Vector3[] waypoints)
{
if (!IsBoos)
{
PlayerMovePos.instance.PlayAni.SetInteger("State", 1);
MaskContro.instance.SetMask(true);
}
MoveOutParent();
// 使用 DoTween 的 DOPath 方法创建路径动画
Tween pathTween = objectToMove.DOPath(waypoints, duration, PathType.Linear)
.SetEase(Ease.Linear) // 线性过渡效果
.SetLoops(isLooping ? -1 : 0)
.OnComplete(AfterMove);
.SetEase(Ease.Linear) // 设置线性过渡效果
.SetLoops(isLooping ? -1 : 0)
.OnWaypointChange((index) =>
{
// 当物体到达某个路径点时回调
if (index < waypoints.Length - 1)
{
Vector3 currentWaypoint = waypoints[index];
Vector3 nextWaypoint = waypoints[index + 1];
if (IsBoos)
{
if (nextWaypoint.x < currentWaypoint.x && !BossContro.instance.IsLeft)
{
BossContro.instance.IsLeft = true;
// 旋转物体使其面向左侧绕Y轴旋转180度
Rotate();
}
else if (nextWaypoint.x > currentWaypoint.x && BossContro.instance.IsLeft)
{
BossContro.instance.IsLeft = false;
Rotate();
}
}
else
{
// 判断物体是否需要旋转
if (nextWaypoint.x < currentWaypoint.x && !PlayerMovePos.instance.IsLeft)
{
PlayerMovePos.instance.IsLeft = true;
// 旋转物体使其面向左侧绕Y轴旋转180度
Rotate();
}
else if (nextWaypoint.x > currentWaypoint.x && PlayerMovePos.instance.IsLeft)
{
PlayerMovePos.instance.IsLeft = false;
Rotate();
}
}
}
})
.OnComplete(AfterMove);
}
}

View File

@ -12,6 +12,12 @@ public class PlayerMovePos : MonoBehaviour
public bool HadChoise;//是否选择房间
public Transform Parent;
public bool IsReturn;
public Animator PlayAni;
public bool IsLeft;//是否面向左边
public int HouseId;//进的房间编号
// Start is called before the first frame update
void Start()
{
@ -19,9 +25,5 @@ public class PlayerMovePos : MonoBehaviour
}
// Update is called once per frame
void Update()
{
}
}

View File

@ -25,8 +25,14 @@ public class SucceePanel : BasePanel
{
base.HidePanel();
BossContro.instance.ReturnParent();
//BossContro.instance.ReturnParent();
MaskContro.instance.SetMask(false);
//都返回原来的位置
}
public override void ShowPanel()
{
base.ShowPanel();
BossContro.instance.ReturnParent();
}
}

View File

@ -0,0 +1,37 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class TextBox : MonoBehaviour
{
public Text numText;
public Transform ParentHouse;
public Transform Parent;
// Start is called before the first frame update
void Start()
{
transform.SetParent(Parent);//¸Ä±ä¸¸½Úµã£¬ÏÔʾ³öÀ´
numText = transform.Find("Text").GetComponent<Text>();
SetText(0);
}
public void SetText(float add)
{
float start = ParentHouse.GetComponent<HouseInfo>().Money;
ParentHouse.GetComponent<HouseInfo>().Money += add;
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();
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 86af0b6d4b0dc1c4882c0ed9d7f4d950
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View 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()
{
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 015e7df3e26db8d478a224bd7325d49b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: