Commit 3e12e14b authored by wanqing's avatar wanqing

修改流体逻辑

parent 12119bb1
...@@ -46,6 +46,9 @@ public class BattleUI : MonoBehaviour ...@@ -46,6 +46,9 @@ public class BattleUI : MonoBehaviour
public GameObject m_strawberrySymbolObj;//草莓✔ public GameObject m_strawberrySymbolObj;//草莓✔
public GameObject m_lemonSymbolObj;//柠檬✔ public GameObject m_lemonSymbolObj;//柠檬✔
public GameObject m_orangeSymbolObj;//橙子✔ public GameObject m_orangeSymbolObj;//橙子✔
public Text m_strawGoalNum;
public Text m_lemonGoalNum;
public Text m_orangeGoalNum;
public LineUI m_lineUI; public LineUI m_lineUI;
public Action onStartBtn; public Action onStartBtn;
public Action onPosUpBtn; public Action onPosUpBtn;
...@@ -313,6 +316,9 @@ public class BattleUI : MonoBehaviour ...@@ -313,6 +316,9 @@ public class BattleUI : MonoBehaviour
SetStrawberryState(false); SetStrawberryState(false);
SetLemonState(false); SetLemonState(false);
SetOrangeState(false); SetOrangeState(false);
SetStrawberryNum(0);
SetLemonNum(0);
SetOrangeNum(0);
} }
//设置移动次数 //设置移动次数
public void SetMoveNum(int num) public void SetMoveNum(int num)
...@@ -519,6 +525,21 @@ public class BattleUI : MonoBehaviour ...@@ -519,6 +525,21 @@ public class BattleUI : MonoBehaviour
m_orangeSymbolObj.SetActive(value); m_orangeSymbolObj.SetActive(value);
} }
} }
//设置草莓数量
public void SetStrawberryNum(int num)
{
m_strawGoalNum.text = string.Format("{0:d}", GlobalConfig.FruitMoveTotalNum - num);
}
//设置柠檬数量
public void SetLemonNum(int num)
{
m_lemonGoalNum.text = string.Format("{0:d}", GlobalConfig.FruitMoveTotalNum - num);
}
//设置橙子数量
public void SetOrangeNum(int num)
{
m_orangeGoalNum.text = string.Format("{0:d}", GlobalConfig.FruitMoveTotalNum - num);
}
private void OnDestroy() private void OnDestroy()
{ {
for (int i = 0; i < m_objList.Count; i++) for (int i = 0; i < m_objList.Count; i++)
......
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
using UnitySimpleLiquid;
public class FruitItemView : MonoBehaviour public class FruitItemView : MonoBehaviour
{ {
public FruitType m_type; public FruitType m_type;
public EndlessContainer m_container;
public FruitType type => m_type; public FruitType type => m_type;
private Vector3 m_size; private Vector3 m_size;
...@@ -14,6 +16,10 @@ public class FruitItemView : MonoBehaviour ...@@ -14,6 +16,10 @@ public class FruitItemView : MonoBehaviour
private MeshRenderer[] m_fragTrans;//碎块 private MeshRenderer[] m_fragTrans;//碎块
private List<Vector3> m_fragPos = new List<Vector3>();//碎块初始位置 private List<Vector3> m_fragPos = new List<Vector3>();//碎块初始位置
private List<Quaternion> m_fragQua = new List<Quaternion>();//碎块初始旋转 private List<Quaternion> m_fragQua = new List<Quaternion>();//碎块初始旋转
private LiquidContainer m_liquidContainer;//流体特效容器
private Color m_strawberryColor = new Color(1.0f, 57.0f / 255.0f, 30.0f / 255.0f, 160.0f / 255.0f);
private Color m_lemonColor = new Color(1.0f, 220.0f / 255.0f, 0.0f, 160.0f / 255.0f);
private Color m_orangeColor = new Color(1.0f, 151.0f / 255.0f, 22.0f / 255.0f, 160.0f / 255.0f);
private void Awake() private void Awake()
{ {
m_size = transform.localScale; m_size = transform.localScale;
...@@ -26,6 +32,10 @@ public class FruitItemView : MonoBehaviour ...@@ -26,6 +32,10 @@ public class FruitItemView : MonoBehaviour
m_fragPos.Add(varTrans.localPosition); m_fragPos.Add(varTrans.localPosition);
m_fragQua.Add(varTrans.localRotation); m_fragQua.Add(varTrans.localRotation);
} }
if (m_container)
{
m_liquidContainer = m_container.gameObject.GetComponent<LiquidContainer>();
}
} }
//变大动画 //变大动画
public void SetChangeBig() public void SetChangeBig()
...@@ -37,6 +47,32 @@ public class FruitItemView : MonoBehaviour ...@@ -37,6 +47,32 @@ public class FruitItemView : MonoBehaviour
{ {
transform.localScale = Vector3.Lerp(transform.localScale, m_size, 1.0f); transform.localScale = Vector3.Lerp(transform.localScale, m_size, 1.0f);
} }
//生成流体特效
public void SetLiquidEffect()
{
m_container.enabled = true;
if(m_liquidContainer)
{
if(m_type == FruitType.Strawberry)
{
m_liquidContainer.LiquidColor = m_strawberryColor;
}
else if(m_type == FruitType.Lemon)
{
m_liquidContainer.LiquidColor = m_lemonColor;
}
else if(m_type == FruitType.Orange)
{
m_liquidContainer.LiquidColor = m_orangeColor;
}
}
Invoke("DelayStopLiquidEffect", 0.5f);
}
//延迟停止流体特效
void DelayStopLiquidEffect()
{
m_container.enabled = false;
}
//生成碎块 //生成碎块
public void SetFrag() public void SetFrag()
{ {
......
...@@ -18,9 +18,9 @@ public class GlassView : MonoBehaviour ...@@ -18,9 +18,9 @@ public class GlassView : MonoBehaviour
private float m_lemonNum; private float m_lemonNum;
private float m_orangeNum; private float m_orangeNum;
private float m_strawberryMaxNum = 3.0f; private float m_strawberryMaxNum = 10.0f;
private float m_lemonMaxNum = 3.0f; private float m_lemonMaxNum = 10.0f;
private float m_orangeMaxNum = 3.0f; private float m_orangeMaxNum = 10.0f;
private bool m_bControl = true; private bool m_bControl = true;
private float m_speed = 2.0f; private float m_speed = 2.0f;
...@@ -30,6 +30,7 @@ public class GlassView : MonoBehaviour ...@@ -30,6 +30,7 @@ public class GlassView : MonoBehaviour
private string m_orangeAni = "juice_Orange"; private string m_orangeAni = "juice_Orange";
private float m_startPos = 0.28f; private float m_startPos = 0.28f;
private float m_rateMod = 33.33f;
private FruitView m_fruitView; private FruitView m_fruitView;
private void Awake() private void Awake()
...@@ -52,20 +53,23 @@ public class GlassView : MonoBehaviour ...@@ -52,20 +53,23 @@ public class GlassView : MonoBehaviour
if (m_strawberryNum >= m_strawberryMaxNum) if (m_strawberryNum >= m_strawberryMaxNum)
{ {
m_strawberryNum = m_strawberryMaxNum; m_strawberryNum = m_strawberryMaxNum;
BattleCtrl.instance.battleUI.SetStrawberryState(true); //BattleCtrl.instance.battleUI.SetStrawberryState(true);
} }
m_lemonNum += num2; m_lemonNum += num2;
if(m_lemonNum >= m_lemonMaxNum) if(m_lemonNum >= m_lemonMaxNum)
{ {
m_lemonNum = m_lemonMaxNum; m_lemonNum = m_lemonMaxNum;
BattleCtrl.instance.battleUI.SetLemonState(true); //BattleCtrl.instance.battleUI.SetLemonState(true);
} }
m_orangeNum += num3; m_orangeNum += num3;
if(m_orangeNum >= m_orangeMaxNum) if(m_orangeNum >= m_orangeMaxNum)
{ {
m_orangeNum = m_orangeMaxNum; m_orangeNum = m_orangeMaxNum;
BattleCtrl.instance.battleUI.SetOrangeState(true); //BattleCtrl.instance.battleUI.SetOrangeState(true);
} }
//BattleCtrl.instance.battleUI.SetStrawberryNum((int)m_strawberryNum);
//BattleCtrl.instance.battleUI.SetLemonNum((int)m_lemonNum);
//BattleCtrl.instance.battleUI.SetOrangeNum((int)m_orangeNum);
} }
private void Update() private void Update()
{ {
...@@ -79,7 +83,7 @@ public class GlassView : MonoBehaviour ...@@ -79,7 +83,7 @@ public class GlassView : MonoBehaviour
m_strawberryOffest += Time.deltaTime * m_speed; m_strawberryOffest += Time.deltaTime * m_speed;
Vector3 varSize = m_strawberry.localScale; Vector3 varSize = m_strawberry.localScale;
varSize.y = m_strawberryOffest/10.0f; varSize.y = m_strawberryOffest/ m_rateMod;
m_strawberry.localScale = varSize; m_strawberry.localScale = varSize;
//草莓位置 //草莓位置
...@@ -100,7 +104,7 @@ public class GlassView : MonoBehaviour ...@@ -100,7 +104,7 @@ public class GlassView : MonoBehaviour
+ m_lemon.localScale.y*2.0f; + m_lemon.localScale.y*2.0f;
m_orange.localPosition = varOrangePos; m_orange.localPosition = varOrangePos;
} }
m_fruitView.ShowAnimator(m_strawberryAni); //m_fruitView.ShowAnimator(m_strawberryAni);
} }
if(m_lemonOffest < m_lemonNum) if(m_lemonOffest < m_lemonNum)
{ {
...@@ -108,7 +112,7 @@ public class GlassView : MonoBehaviour ...@@ -108,7 +112,7 @@ public class GlassView : MonoBehaviour
m_lemonOffest += Time.deltaTime * m_speed; m_lemonOffest += Time.deltaTime * m_speed;
Vector3 varSize = m_lemon.localScale; Vector3 varSize = m_lemon.localScale;
varSize.y = m_lemonOffest/10.0f; varSize.y = m_lemonOffest/ m_rateMod;
m_lemon.localScale = varSize; m_lemon.localScale = varSize;
Vector3 varPos = m_lemon.localPosition; Vector3 varPos = m_lemon.localPosition;
...@@ -122,7 +126,7 @@ public class GlassView : MonoBehaviour ...@@ -122,7 +126,7 @@ public class GlassView : MonoBehaviour
+ m_lemon.localScale.y*2.0f; + m_lemon.localScale.y*2.0f;
m_orange.localPosition = varOrangePos; m_orange.localPosition = varOrangePos;
} }
m_fruitView.ShowAnimator(m_lemonAni); //m_fruitView.ShowAnimator(m_lemonAni);
} }
if (m_orangeOffest < m_orangeNum && m_orange) if (m_orangeOffest < m_orangeNum && m_orange)
{ {
...@@ -130,21 +134,21 @@ public class GlassView : MonoBehaviour ...@@ -130,21 +134,21 @@ public class GlassView : MonoBehaviour
m_orangeOffest += Time.deltaTime * m_speed; m_orangeOffest += Time.deltaTime * m_speed;
Vector3 varSize = m_orange.localScale; Vector3 varSize = m_orange.localScale;
varSize.y = m_orangeOffest/10.0f; varSize.y = m_orangeOffest/ m_rateMod;
m_orange.localScale = varSize; m_orange.localScale = varSize;
Vector3 varPos = m_orange.localPosition; Vector3 varPos = m_orange.localPosition;
varPos.y = m_startPos+m_strawberry.localScale.y*2.0f varPos.y = m_startPos+m_strawberry.localScale.y*2.0f
+ m_lemon.localScale.y*2.0f; + m_lemon.localScale.y*2.0f;
m_orange.localPosition = varPos; m_orange.localPosition = varPos;
m_fruitView.ShowAnimator(m_orangeAni); //m_fruitView.ShowAnimator(m_orangeAni);
} }
if (BattleCtrl.instance.levelManager.CurLevelIndex == LevelEnum.levelOneIndex) if (BattleCtrl.instance.levelManager.CurLevelIndex == LevelEnum.levelOneIndex)
{ {
if(m_strawberryOffest >= m_strawberryNum && m_lemonOffest >= m_lemonNum) //if(m_strawberryOffest >= m_strawberryNum && m_lemonOffest >= m_lemonNum)
{ //{
m_fruitView.HideAnimator(); // m_fruitView.HideAnimator();
} //}
if (m_strawberryOffest >= m_strawberryMaxNum && m_lemonOffest >= m_lemonMaxNum if (m_strawberryOffest >= m_strawberryMaxNum && m_lemonOffest >= m_lemonMaxNum
&& m_bControl) && m_bControl)
{ {
...@@ -155,11 +159,11 @@ public class GlassView : MonoBehaviour ...@@ -155,11 +159,11 @@ public class GlassView : MonoBehaviour
else if (BattleCtrl.instance.levelManager.CurLevelIndex == LevelEnum.levelTwoIndex else if (BattleCtrl.instance.levelManager.CurLevelIndex == LevelEnum.levelTwoIndex
|| BattleCtrl.instance.levelManager.CurLevelIndex == LevelEnum.levelThreeIndex) || BattleCtrl.instance.levelManager.CurLevelIndex == LevelEnum.levelThreeIndex)
{ {
if (m_strawberryOffest >= m_strawberryNum && m_lemonOffest >= m_lemonNum //if (m_strawberryOffest >= m_strawberryNum && m_lemonOffest >= m_lemonNum
&& m_orangeOffest >= m_orangeNum) // && m_orangeOffest >= m_orangeNum)
{ //{
m_fruitView.HideAnimator(); // m_fruitView.HideAnimator();
} //}
if (m_strawberryOffest >= m_strawberryMaxNum && m_lemonOffest >= m_lemonMaxNum if (m_strawberryOffest >= m_strawberryMaxNum && m_lemonOffest >= m_lemonMaxNum
&& m_orangeOffest >= m_orangeMaxNum && m_bControl) && m_orangeOffest >= m_orangeMaxNum && m_bControl)
{ {
......
...@@ -37,7 +37,7 @@ public class GlobalConfig ...@@ -37,7 +37,7 @@ public class GlobalConfig
public static float CanvaUIScaleX = BattleCtrl.instance.battleUI.gameObject.transform.localScale.x;//uicanva适配大小 public static float CanvaUIScaleX = BattleCtrl.instance.battleUI.gameObject.transform.localScale.x;//uicanva适配大小
//水果可以切的次数 //水果可以切的次数
public static int FruitMoveTotalNum = 3; public static int FruitMoveTotalNum = 10;
//通过当前关卡返回总的数量 //通过当前关卡返回总的数量
public static int TotalNum() public static int TotalNum()
......
...@@ -3827,7 +3827,7 @@ RectTransform: ...@@ -3827,7 +3827,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 95, y: -9} m_AnchoredPosition: {x: 100, y: -9}
m_SizeDelta: {x: 160, y: 30} m_SizeDelta: {x: 160, y: 30}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &7587638407268349327 --- !u!222 &7587638407268349327
...@@ -3870,7 +3870,7 @@ MonoBehaviour: ...@@ -3870,7 +3870,7 @@ MonoBehaviour:
m_HorizontalOverflow: 1 m_HorizontalOverflow: 1
m_VerticalOverflow: 1 m_VerticalOverflow: 1
m_LineSpacing: 1 m_LineSpacing: 1
m_Text: 3 m_Text: 10
--- !u!1 &3457795603069500219 --- !u!1 &3457795603069500219
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
...@@ -4034,7 +4034,7 @@ RectTransform: ...@@ -4034,7 +4034,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 94, y: -20} m_AnchoredPosition: {x: 100, y: -20}
m_SizeDelta: {x: 160, y: 30} m_SizeDelta: {x: 160, y: 30}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &4333726236760191702 --- !u!222 &4333726236760191702
...@@ -4077,7 +4077,7 @@ MonoBehaviour: ...@@ -4077,7 +4077,7 @@ MonoBehaviour:
m_HorizontalOverflow: 1 m_HorizontalOverflow: 1
m_VerticalOverflow: 1 m_VerticalOverflow: 1
m_LineSpacing: 1 m_LineSpacing: 1
m_Text: 3 m_Text: 10
--- !u!1 &4109590137141898934 --- !u!1 &4109590137141898934
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
...@@ -4758,7 +4758,7 @@ RectTransform: ...@@ -4758,7 +4758,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 94, y: -10} m_AnchoredPosition: {x: 115, y: -10}
m_SizeDelta: {x: 160, y: 30} m_SizeDelta: {x: 160, y: 30}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &4075179019841173522 --- !u!222 &4075179019841173522
...@@ -4801,7 +4801,7 @@ MonoBehaviour: ...@@ -4801,7 +4801,7 @@ MonoBehaviour:
m_HorizontalOverflow: 1 m_HorizontalOverflow: 1
m_VerticalOverflow: 1 m_VerticalOverflow: 1
m_LineSpacing: 1 m_LineSpacing: 1
m_Text: 3 m_Text: 10
--- !u!1 &5156541820109564448 --- !u!1 &5156541820109564448
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
...@@ -13313,6 +13313,9 @@ MonoBehaviour: ...@@ -13313,6 +13313,9 @@ MonoBehaviour:
m_strawberrySymbolObj: {fileID: 2276373580177298909} m_strawberrySymbolObj: {fileID: 2276373580177298909}
m_lemonSymbolObj: {fileID: 7080706849099009272} m_lemonSymbolObj: {fileID: 7080706849099009272}
m_orangeSymbolObj: {fileID: 5562945445041803326} m_orangeSymbolObj: {fileID: 5562945445041803326}
m_strawGoalNum: {fileID: 3881136866626937667}
m_lemonGoalNum: {fileID: 443889951056952148}
m_orangeGoalNum: {fileID: 6194158529442749815}
m_lineUI: {fileID: 222345270} m_lineUI: {fileID: 222345270}
--- !u!114 &1995691973 --- !u!114 &1995691973
MonoBehaviour: MonoBehaviour:
...@@ -15833,8 +15836,8 @@ RectTransform: ...@@ -15833,8 +15836,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0} m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 115, y: 442} m_AnchoredPosition: {x: 148, y: 442}
m_SizeDelta: {x: 160, y: 30} m_SizeDelta: {x: 75, y: 30}
m_Pivot: {x: 0, y: 0} m_Pivot: {x: 0, y: 0}
--- !u!222 &5400858707778577745 --- !u!222 &5400858707778577745
CanvasRenderer: CanvasRenderer:
...@@ -15870,13 +15873,13 @@ MonoBehaviour: ...@@ -15870,13 +15873,13 @@ MonoBehaviour:
m_BestFit: 0 m_BestFit: 0
m_MinSize: 0 m_MinSize: 0
m_MaxSize: 100 m_MaxSize: 100
m_Alignment: 4 m_Alignment: 3
m_AlignByGeometry: 0 m_AlignByGeometry: 0
m_RichText: 1 m_RichText: 1
m_HorizontalOverflow: 1 m_HorizontalOverflow: 1
m_VerticalOverflow: 1 m_VerticalOverflow: 1
m_LineSpacing: 1 m_LineSpacing: 1
m_Text: 3 m_Text: 10
--- !u!1 &9114938694515689495 --- !u!1 &9114938694515689495
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment