Commit c56b9d8c authored by czy's avatar czy

吃随机生成的食物

parent 75734bd9
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
//using System.Collections;
//using System.Collections.Generic;
//using UnityEngine;
public class GroundCollision : MonoBehaviour
{
private ChainRopeView m_chainRopeView;
private void Start()
{
m_chainRopeView = BattleCtrl.instance.levelManager.curLevel.chainRopeView;
}
private void OnCollisionEnter(Collision other)
{
if (CanGetCatch(other) && m_chainRopeView.IsCatch && m_chainRopeView.CatchTouchUp)
{
m_chainRopeView.CatchObjEnterGround();
}
}
bool CanGetCatch(Collision ohter)
{
return string.Equals(ohter.gameObject.name, GameServices.configService.levelConfig.firstLevelGoalName)
|| string.Equals(ohter.gameObject.name, GameServices.configService.levelConfig.secondLevelGoalName)
|| string.Equals(ohter.gameObject.name, GameServices.configService.levelConfig.thirdLevelGoalName)
|| string.Equals(ohter.gameObject.name, GameServices.configService.levelConfig.fourthLevelGoalName)
|| string.Equals(ohter.gameObject.name, "Claw");
}
}
//public class GroundCollision : MonoBehaviour
//{
// private ChainRopeView m_chainRopeView;
// private void Start()
// {
// m_chainRopeView = BattleCtrl.instance.levelManager.curLevel.chainRopeView;
// }
// private void OnCollisionEnter(Collision other)
// {
// if (CanGetCatch(other) && m_chainRopeView.IsCatch && m_chainRopeView.CatchTouchUp)
// {
// m_chainRopeView.CatchObjEnterGround();
// }
// }
// //bool CanGetCatch(Collision ohter)
// //{
// // return string.Equals(ohter.gameObject.name, GameServices.configService.levelConfig.firstLevelGoalName)
// // || string.Equals(ohter.gameObject.name, GameServices.configService.levelConfig.secondLevelGoalName)
// // || string.Equals(ohter.gameObject.name, GameServices.configService.levelConfig.thirdLevelGoalName)
// // || string.Equals(ohter.gameObject.name, GameServices.configService.levelConfig.fourthLevelGoalName)
// // || string.Equals(ohter.gameObject.name, "Claw");
// //}
//}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
//using System.Collections;
//using System.Collections.Generic;
//using UnityEngine;
public class ThirdLevelBoxCollision : MonoBehaviour
{
public GameObject[] m_needRigidBody;
public Transform m_targetTrans;
public GameObject m_bottomObj;
private bool m_bIsRigid = false;//是否有刚体
private bool m_bIsTrigger = false;//是否碰到了目标
private Vector3 m_pos = new Vector3(-0.73f, 1.19f, -2.54f);
private Quaternion m_rotation = Quaternion.Euler(0, 83.33f, 0);
private bool m_bControl = true;
private void OnCollisionEnter(Collision other)
{
if (string.Equals(other.gameObject.name, "Claw"))
{
m_bIsRigid = true;
BattleCtrl.instance.levelManager.curLevel.chainRopeView.EnterTargerView();
for(int i = 0;i< m_needRigidBody.Length;i++)
{
m_needRigidBody[i].AddComponent<Rigidbody>();
}
GameServices.timerServices.Push(this, 1.0f, delegate
{
for (int i = 0; i < m_needRigidBody.Length; i++)
{
if(m_needRigidBody[i])
{
m_needRigidBody[i].SetActive(false);
}
}
if(m_bottomObj)
{
m_bottomObj.SetActive(false);
}
});
if (m_bIsTrigger && m_bIsRigid)
{
if(m_bControl)
{
m_bControl = false;
BattleCtrl.instance.OnBattleWin();
}
//m_targetTrans.localPosition = m_pos;
//m_targetTrans.localRotation = m_rotation;
}
}
}
//碰到了目标
public void SetEnterTarget()
{
m_bIsTrigger = true;
if(m_bIsTrigger && m_bIsRigid)
{
if (m_bControl)
{
m_bControl = false;
BattleCtrl.instance.OnBattleWin();
}
//m_targetTrans.localPosition = m_pos;
//m_targetTrans.localRotation = m_rotation;
}
}
}
//public class ThirdLevelBoxCollision : MonoBehaviour
//{
// public GameObject[] m_needRigidBody;
// public Transform m_targetTrans;
// public GameObject m_bottomObj;
// private bool m_bIsRigid = false;//是否有刚体
// private bool m_bIsTrigger = false;//是否碰到了目标
// private Vector3 m_pos = new Vector3(-0.73f, 1.19f, -2.54f);
// private Quaternion m_rotation = Quaternion.Euler(0, 83.33f, 0);
// private bool m_bControl = true;
// private void OnCollisionEnter(Collision other)
// {
// if (string.Equals(other.gameObject.name, "Claw"))
// {
// m_bIsRigid = true;
// BattleCtrl.instance.levelManager.curLevel.chainRopeView.EnterTargerView();
// for(int i = 0;i< m_needRigidBody.Length;i++)
// {
// m_needRigidBody[i].AddComponent<Rigidbody>();
// }
// GameServices.timerServices.Push(this, 1.0f, delegate
// {
// for (int i = 0; i < m_needRigidBody.Length; i++)
// {
// if(m_needRigidBody[i])
// {
// m_needRigidBody[i].SetActive(false);
// }
// }
// if(m_bottomObj)
// {
// m_bottomObj.SetActive(false);
// }
// });
// if (m_bIsTrigger && m_bIsRigid)
// {
// if(m_bControl)
// {
// m_bControl = false;
// BattleCtrl.instance.OnBattleWin();
// }
// //m_targetTrans.localPosition = m_pos;
// //m_targetTrans.localRotation = m_rotation;
// }
// }
// }
// //碰到了目标
// public void SetEnterTarget()
// {
// m_bIsTrigger = true;
// if(m_bIsTrigger && m_bIsRigid)
// {
// if (m_bControl)
// {
// m_bControl = false;
// BattleCtrl.instance.OnBattleWin();
// }
// //m_targetTrans.localPosition = m_pos;
// //m_targetTrans.localRotation = m_rotation;
// }
// }
//}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
//using System.Collections;
//using System.Collections.Generic;
//using UnityEngine;
public class ThirdLevelBoxTarget : MonoBehaviour
{
public ThirdLevelBoxCollision m_levelBoxCollison;
private void OnTriggerEnter(Collider other)
{
if (other != null && other.gameObject && other.gameObject.GetComponent<TargetView>() != null
&& other.gameObject.GetComponent<TargetView>().parentTrans != null)
{
GameObject varObj = other.gameObject.GetComponent<TargetView>().parentTrans.gameObject;
if (string.Equals(varObj.name, "Boy_01"))
{
TargetView varView = varObj.GetComponent<TargetView>();
if(!varView.rigidBody)
{
return;
}
BattleCtrl.instance.levelManager.curLevel.chainRopeView.CatchObjEnterTarget();
m_levelBoxCollison.SetEnterTarget();
if (varView)
{
varView.DestroyRigidByOther();
}
}
}
}
}
//public class ThirdLevelBoxTarget : MonoBehaviour
//{
// public ThirdLevelBoxCollision m_levelBoxCollison;
// private void OnTriggerEnter(Collider other)
// {
// if (other != null && other.gameObject && other.gameObject.GetComponent<TargetView>() != null
// && other.gameObject.GetComponent<TargetView>().parentTrans != null)
// {
// GameObject varObj = other.gameObject.GetComponent<TargetView>().parentTrans.gameObject;
// if (string.Equals(varObj.name, "Boy_01"))
// {
// TargetView varView = varObj.GetComponent<TargetView>();
// if(!varView.rigidBody)
// {
// return;
// }
// BattleCtrl.instance.levelManager.curLevel.chainRopeView.CatchObjEnterTarget();
// m_levelBoxCollison.SetEnterTarget();
// if (varView)
// {
// varView.DestroyRigidByOther();
// }
// }
// }
// }
//}
......@@ -19,9 +19,9 @@ public class FifthLevelTrigger : MonoBehaviour
private void Start()
{
m_mouseRigidBody = m_mousePosTrans.gameObject.GetComponent<Rigidbody>();
BattleCtrl.instance.levelManager.curLevel.chainRopeView.onBalloonEnterTarget += onBalloonEnterTarget;
BattleCtrl.instance.levelManager.curLevel.chainRopeView.onBalloonEnterGround += onBalloonEnterGround;
BattleCtrl.instance.levelManager.curLevel.chainRopeView.onBalloonEnterSuccessTarget += onBalloonEnterSuccessTarget;
//BattleCtrl.instance.levelManager.curLevel.chainRopeView.onBalloonEnterTarget += onBalloonEnterTarget;
//BattleCtrl.instance.levelManager.curLevel.chainRopeView.onBalloonEnterGround += onBalloonEnterGround;
//BattleCtrl.instance.levelManager.curLevel.chainRopeView.onBalloonEnterSuccessTarget += onBalloonEnterSuccessTarget;
//m_rigidBody = gameObject.GetComponentsInChildren<Rigidbody>();
}
void onBalloonEnterTarget()
......
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
//using System.Collections;
//using System.Collections.Generic;
//using UnityEngine;
public class FourthLevelTrigger : MonoBehaviour
{
public Transform m_targetTrans;
private Vector3 m_pos = new Vector3(0.21f,1.0f, -0.98f);
private Quaternion m_rotation = Quaternion.Euler(-14.7f, -146, -12.6f);
//public class FourthLevelTrigger : MonoBehaviour
//{
// public Transform m_targetTrans;
// private Vector3 m_pos = new Vector3(0.21f,1.0f, -0.98f);
// private Quaternion m_rotation = Quaternion.Euler(-14.7f, -146, -12.6f);
private void OnTriggerEnter(Collider other)
{
if (other.gameObject.CompareTag("Target"))
{
BattleCtrl.instance.levelManager.curLevel.chainRopeView.CatchObjEnterTarget();
BattleCtrl.instance.OnBattleWin();
m_targetTrans.localPosition = m_pos;
m_targetTrans.localRotation = m_rotation;
}
}
}
// private void OnTriggerEnter(Collider other)
// {
// if (other.gameObject.CompareTag("Target"))
// {
// BattleCtrl.instance.levelManager.curLevel.chainRopeView.CatchObjEnterTarget();
// BattleCtrl.instance.OnBattleWin();
// m_targetTrans.localPosition = m_pos;
// m_targetTrans.localRotation = m_rotation;
// }
// }
//}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
//using System.Collections;
//using System.Collections.Generic;
//using UnityEngine;
public class LeftClawTrigger : MonoBehaviour
{
private void Awake()
{
//Mesh mesh = transform.GetComponent<MeshFilter>().mesh;
//MeshCollider col = this.GetComponent<MeshCollider>();
//col.sharedMesh = mesh;
}
private void OnTriggerEnter(Collider other)
{
if (other.gameObject.CompareTag("Target"))
{
//特殊处理,因为碰到的骨骼可能不一样
if (BattleCtrl.instance.levelManager.CurLevelIndex == LevelEnum.levelThreeIndex ||
BattleCtrl.instance.levelManager.CurLevelIndex == LevelEnum.levelFourIndex)
{
GameObject varObj = other.gameObject.GetComponent<TargetView>().parentTrans.gameObject;
BattleCtrl.instance.levelManager.curLevel.chainRopeView.EnterLeftClaw(varObj);
}
else
{
BattleCtrl.instance.levelManager.curLevel.chainRopeView.EnterLeftClaw(other.gameObject);
}
}
}
private void OnTriggerExit(Collider other)
{
if (other.gameObject.CompareTag("Target"))
{
BattleCtrl.instance.levelManager.curLevel.chainRopeView.ExitLeftClaw();
}
}
}
//public class LeftClawTrigger : MonoBehaviour
//{
// private void Awake()
// {
// //Mesh mesh = transform.GetComponent<MeshFilter>().mesh;
// //MeshCollider col = this.GetComponent<MeshCollider>();
// //col.sharedMesh = mesh;
// }
// private void OnTriggerEnter(Collider other)
// {
// if (other.gameObject.CompareTag("Target"))
// {
// //特殊处理,因为碰到的骨骼可能不一样
// if (BattleCtrl.instance.levelManager.CurLevelIndex == LevelEnum.levelThreeIndex ||
// BattleCtrl.instance.levelManager.CurLevelIndex == LevelEnum.levelFourIndex)
// {
// GameObject varObj = other.gameObject.GetComponent<TargetView>().parentTrans.gameObject;
// BattleCtrl.instance.levelManager.curLevel.chainRopeView.EnterLeftClaw(varObj);
// }
// else
// {
// BattleCtrl.instance.levelManager.curLevel.chainRopeView.EnterLeftClaw(other.gameObject);
// }
// }
// }
// private void OnTriggerExit(Collider other)
// {
// if (other.gameObject.CompareTag("Target"))
// {
// BattleCtrl.instance.levelManager.curLevel.chainRopeView.ExitLeftClaw();
// }
// }
//}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
//using System.Collections;
//using System.Collections.Generic;
//using UnityEngine;
public class LevelLimitTrigger : MonoBehaviour
{
private ChainRopeView m_chainRopeView;
private bool m_bControl = true;
private void Start()
{
m_chainRopeView = BattleCtrl.instance.levelManager.curLevel.chainRopeView;
}
private void OnTriggerEnter(Collider other)
{
if (other.gameObject.CompareTag("Target") && !m_chainRopeView.IsCatch && m_bControl)
{
m_bControl = false;
BattleCtrl.instance.OnBattleFail();
}
}
}
//public class LevelLimitTrigger : MonoBehaviour
//{
// private ChainRopeView m_chainRopeView;
// private bool m_bControl = true;
// private void Start()
// {
// m_chainRopeView = BattleCtrl.instance.levelManager.curLevel.chainRopeView;
// }
// private void OnTriggerEnter(Collider other)
// {
// if (other.gameObject.CompareTag("Target") && !m_chainRopeView.IsCatch && m_bControl)
// {
// m_bControl = false;
// BattleCtrl.instance.OnBattleFail();
// }
// }
//}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
//using System.Collections;
//using System.Collections.Generic;
//using UnityEngine;
public class RightClawTrigger : MonoBehaviour
{
private void Awake()
{
//Mesh mesh = transform.GetComponent<MeshFilter>().mesh;
//MeshCollider col = this.GetComponent<MeshCollider>();
//col.sharedMesh = mesh;
}
private void OnTriggerEnter(Collider other)
{
if (other.gameObject.CompareTag("Target"))
{
//特殊处理,因为碰到的骨骼可能不一样
if (BattleCtrl.instance.levelManager.CurLevelIndex == LevelEnum.levelThreeIndex ||
BattleCtrl.instance.levelManager.CurLevelIndex == LevelEnum.levelFourIndex)
{
GameObject varObj = other.gameObject.GetComponent<TargetView>().parentTrans.gameObject;
BattleCtrl.instance.levelManager.curLevel.chainRopeView.EnterRightClaw(varObj);
}
else
{
BattleCtrl.instance.levelManager.curLevel.chainRopeView.EnterRightClaw(other.gameObject);
}
}
}
private void OnTriggerExit(Collider other)
{
if (other.gameObject.CompareTag("Target"))
{
BattleCtrl.instance.levelManager.curLevel.chainRopeView.ExitRightClaw();
}
}
}
//public class RightClawTrigger : MonoBehaviour
//{
// private void Awake()
// {
// //Mesh mesh = transform.GetComponent<MeshFilter>().mesh;
// //MeshCollider col = this.GetComponent<MeshCollider>();
// //col.sharedMesh = mesh;
// }
// private void OnTriggerEnter(Collider other)
// {
// if (other.gameObject.CompareTag("Target"))
// {
// //特殊处理,因为碰到的骨骼可能不一样
// if (BattleCtrl.instance.levelManager.CurLevelIndex == LevelEnum.levelThreeIndex ||
// BattleCtrl.instance.levelManager.CurLevelIndex == LevelEnum.levelFourIndex)
// {
// GameObject varObj = other.gameObject.GetComponent<TargetView>().parentTrans.gameObject;
// BattleCtrl.instance.levelManager.curLevel.chainRopeView.EnterRightClaw(varObj);
// }
// else
// {
// BattleCtrl.instance.levelManager.curLevel.chainRopeView.EnterRightClaw(other.gameObject);
// }
// }
// }
// private void OnTriggerExit(Collider other)
// {
// if (other.gameObject.CompareTag("Target"))
// {
// BattleCtrl.instance.levelManager.curLevel.chainRopeView.ExitRightClaw();
// }
// }
//}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
//using System.Collections;
//using System.Collections.Generic;
//using UnityEngine;
public class SevenLevelOneTrigger : MonoBehaviour
{
public SevenLevelTwoTrigger m_levelTwo;
private bool m_bControl = true;
private void OnTriggerEnter(Collider other)
{
if (other.gameObject.CompareTag("Target") && m_bControl)
{
m_bControl = false;
m_levelTwo.OnTriggerOne();
GameServices.timerServices.Push(this, 1.0f, delegate
{
if (m_levelTwo.Control)
{
m_bControl = true;
}
});
}
}
}
//public class SevenLevelOneTrigger : MonoBehaviour
//{
// public SevenLevelTwoTrigger m_levelTwo;
// private bool m_bControl = true;
// private void OnTriggerEnter(Collider other)
// {
// if (other.gameObject.CompareTag("Target") && m_bControl)
// {
// m_bControl = false;
// m_levelTwo.OnTriggerOne();
// GameServices.timerServices.Push(this, 1.0f, delegate
// {
// if (m_levelTwo.Control)
// {
// m_bControl = true;
// }
// });
// }
// }
//}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
//using System.Collections;
//using System.Collections.Generic;
//using UnityEngine;
public class SevenLevelTwoTrigger : MonoBehaviour
{
private bool m_bTriggerOne = false;
private bool m_bTriggerTwo = false;
private bool m_bControl = true;
public bool Control => m_bControl;
private void OnTriggerEnter(Collider other)
{
if (other.gameObject.CompareTag("Target") && !m_bTriggerTwo)
{
m_bTriggerTwo = true;
if (m_bTriggerTwo && m_bTriggerOne)
{
if (m_bControl)
{
m_bControl = false;
BattleCtrl.instance.OnBattleWin();
BattleCtrl.instance.levelManager.curLevel.chainRopeView.CatchObjEnterTarget();
}
}
GameServices.timerServices.Push(this, 1.0f, delegate
{
if (m_bControl)
{
m_bTriggerTwo = false;
}
});
}
}
public void OnTriggerOne()
{
m_bTriggerOne = true;
if (m_bTriggerTwo && m_bTriggerOne)
{
if (m_bControl)
{
m_bControl = false;
BattleCtrl.instance.OnBattleWin();
BattleCtrl.instance.levelManager.curLevel.chainRopeView.CatchObjEnterTarget();
}
}
GameServices.timerServices.Push(this, 1.0f, delegate
{
if(m_bControl)
{
m_bTriggerOne = false;
}
});
}
}
//public class SevenLevelTwoTrigger : MonoBehaviour
//{
// private bool m_bTriggerOne = false;
// private bool m_bTriggerTwo = false;
// private bool m_bControl = true;
// public bool Control => m_bControl;
// private void OnTriggerEnter(Collider other)
// {
// if (other.gameObject.CompareTag("Target") && !m_bTriggerTwo)
// {
// m_bTriggerTwo = true;
// if (m_bTriggerTwo && m_bTriggerOne)
// {
// if (m_bControl)
// {
// m_bControl = false;
// BattleCtrl.instance.OnBattleWin();
// BattleCtrl.instance.levelManager.curLevel.chainRopeView.CatchObjEnterTarget();
// }
// }
// GameServices.timerServices.Push(this, 1.0f, delegate
// {
// if (m_bControl)
// {
// m_bTriggerTwo = false;
// }
// });
// }
// }
// public void OnTriggerOne()
// {
// m_bTriggerOne = true;
// if (m_bTriggerTwo && m_bTriggerOne)
// {
// if (m_bControl)
// {
// m_bControl = false;
// BattleCtrl.instance.OnBattleWin();
// BattleCtrl.instance.levelManager.curLevel.chainRopeView.CatchObjEnterTarget();
// }
// }
// GameServices.timerServices.Push(this, 1.0f, delegate
// {
// if(m_bControl)
// {
// m_bTriggerOne = false;
// }
// });
// }
//}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
//using System.Collections;
//using System.Collections.Generic;
//using UnityEngine;
//第三根爪
public class ThreeClawTrigger : MonoBehaviour
{
private void OnTriggerEnter(Collider other)
{
if (other.gameObject.CompareTag("Target"))
{
BattleCtrl.instance.levelManager.curLevel.chainRopeView.EnterThreeClaw(other.gameObject);
}
}
private void OnTriggerExit(Collider other)
{
if (other.gameObject.CompareTag("Target"))
{
BattleCtrl.instance.levelManager.curLevel.chainRopeView.ExitThreeClaw();
}
}
}
////第三根爪
//public class ThreeClawTrigger : MonoBehaviour
//{
// private void OnTriggerEnter(Collider other)
// {
// if (other.gameObject.CompareTag("Target"))
// {
// BattleCtrl.instance.levelManager.curLevel.chainRopeView.EnterThreeClaw(other.gameObject);
// }
// }
// private void OnTriggerExit(Collider other)
// {
// if (other.gameObject.CompareTag("Target"))
// {
// BattleCtrl.instance.levelManager.curLevel.chainRopeView.ExitThreeClaw();
// }
// }
//}
......@@ -7,8 +7,7 @@ using System;
public class BattleUI : MonoBehaviour
{
public Button m_dragBtn;
public Button m_moveBtn;
public Button m_restartBtn;
public Button m_nextLevelBtn;
public Button m_selectBtn;
......@@ -74,8 +73,6 @@ public class BattleUI : MonoBehaviour
void Awake()
{
instance = this;
m_dragBtn.onClick.AddListener(SetDragMode);
m_moveBtn.onClick.AddListener(SetMoveMode);
m_restartBtn.onClick.AddListener(LoadCurLevel);
m_nextLevelBtn.onClick.AddListener(NextLevelBtnDown);
m_selectBtn.onClick.AddListener(SelectLevel);
......@@ -87,17 +84,19 @@ public class BattleUI : MonoBehaviour
//m_fieldFarBtn.onClick.AddListener(FieldFarBtn);
//m_fieldNearBtn.onClick.AddListener(FieldNearBtn);
//m_ShowOrHideMouseText = m_ShowOrHideMouseObj.GetComponentInChildren<Text>();
GameServices.audioServices.PlayBgm(GameServices.configService.audioConfig.GameBgm);
GameServices.configService.playerConfig.ClawMoveSpeed = 0.4f;//开始默认值
BattleCtrl.instance.updateScore += UpdateScore;
BattleCtrl.instance.updateRanking += UpdateRanking;
BattleCtrl.instance.turnNextLevel += NextLevel;
//GameServices.audioServices.PlayBgm(GameServices.configService.audioConfig.GameBgm);
//GameServices.configService.playerConfig.ClawMoveSpeed = 0.4f;//开始默认值
}
private void Start()
{
m_boomBtn.interactable = false;
m_joystickImage = GameServices.inputService.joyStick.GetComponent<Image>();
m_thumbImage = GameServices.inputService.joyStick.thumb.GetComponent<Image>();
BattleCtrl.instance.updateScore += UpdateScore;
BattleCtrl.instance.updateRanking += UpdateRanking;
BattleCtrl.instance.turnNextLevel += NextLevel;
}
private void Update()
{
......@@ -114,14 +113,14 @@ public class BattleUI : MonoBehaviour
//print("游戏是否开始:"+ BattleCtrl.instance.isStartBattle);
//print("游戏是否结束:"+ BattleCtrl.instance.isEndBattle);
}
void SetDragMode()
{
BattleCtrl.instance.levelManager.curLevel.chainView.SetDragMode(true);
}
void SetMoveMode()
{
BattleCtrl.instance.levelManager.curLevel.chainView.SetDragMode(false);
}
//void SetDragMode()
//{
// BattleCtrl.instance.levelManager.curLevel.chainView.SetDragMode(true);
//}
//void SetMoveMode()
//{
// BattleCtrl.instance.levelManager.curLevel.chainView.SetDragMode(false);
//}
// 当前关卡再来一次
void LoadCurLevel()
{
......@@ -178,6 +177,7 @@ public class BattleUI : MonoBehaviour
//开始游戏
void StartBtn()
{
print("点击开始按钮");
onStartBtn?.Invoke();
//m_startBtn.gameObject.SetActive(false);
m_startLogoObj.SetActive(false);
......@@ -234,19 +234,19 @@ public class BattleUI : MonoBehaviour
m_cameraFieldView.text = string.Format("fieldView{0:f1}", varCam.fieldOfView);
}
}
//爪子移动速度增加
public void ClawMoveSpeedAddBtn()
{
onClawMoveSpeedAddBtn?.Invoke();
m_clawMoveSpeed.text = string.Format("系数越小,越快\n{0:f3}", GameServices.configService.playerConfig.ClawMoveSpeed);
////爪子移动速度增加
//public void ClawMoveSpeedAddBtn()
//{
// onClawMoveSpeedAddBtn?.Invoke();
// m_clawMoveSpeed.text = string.Format("系数越小,越快\n{0:f3}", GameServices.configService.playerConfig.ClawMoveSpeed);
}
//爪子移动速度减少
public void ClawMoveSpeedDownBtn()
{
onClawMoveSpeedDownBtn?.Invoke();
m_clawMoveSpeed.text = string.Format("系数越小,越快\n{0:f3}", GameServices.configService.playerConfig.ClawMoveSpeed);
}
//}
////爪子移动速度减少
//public void ClawMoveSpeedDownBtn()
//{
// onClawMoveSpeedDownBtn?.Invoke();
// m_clawMoveSpeed.text = string.Format("系数越小,越快\n{0:f3}", GameServices.configService.playerConfig.ClawMoveSpeed);
//}
//胜利
public void OnBattleWin()
{
......@@ -335,7 +335,7 @@ public class BattleUI : MonoBehaviour
}
GameServices.timerServices.Push(this, 1, delegate
{
m_clawMoveSpeed.text = string.Format("系数越小,越快\n{0:f3}", GameServices.configService.playerConfig.ClawMoveSpeed);
//m_clawMoveSpeed.text = string.Format("系数越小,越快\n{0:f3}", GameServices.configService.playerConfig.ClawMoveSpeed);
});
//开始----------------
//TinySauce.OnGameStarted(string.Format("{0:d}", (BattleCtrl.instance.levelManager.CurLevelIndex + 1)));
......@@ -409,15 +409,15 @@ public class BattleUI : MonoBehaviour
public void ShowJoystick()
{
print("显示摇杆");
//m_joystickImage.color = Color.white;
//m_thumbImage.color = Color.white;
m_joystickImage.color = Color.white;
m_thumbImage.color = Color.white;
}
//摇杆图标隐藏
public void HideJoystick()
{
print("隐藏摇杆");
//m_joystickImage.color = Color.clear;
//m_thumbImage.color = Color.clear;
m_joystickImage.color = Color.clear;
m_thumbImage.color = Color.clear;
}
public void UpdateScore()
{
......
......@@ -74,7 +74,7 @@ public class SettingPanel : MonoBehaviour
}
else
{
GameServices.audioServices.PlayBgm(GameServices.configService.audioConfig.GameBgm);
// GameServices.audioServices.PlayBgm(GameServices.configService.audioConfig.GameBgm);
}
}
public void OnCloseClick()
......
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
//using System.Collections;
//using System.Collections.Generic;
//using UnityEngine;
public class ChainDragView : MonoBehaviour
{
public Transform m_topTrans;
private float m_topPosY;
private void Start()
{
m_topPosY = m_topTrans.position.y;
GameServices.inputService.pad.onMoveVec3 += OnMove;
}
//移动
void OnMove(Vector3 dir)
{
float varParamDis = Screen.width * 0.8f / 2;//参数距离
Vector3 varPos = m_topTrans.position;
//向左滑
if (dir.x > 0)
{
varPos.x -= dir.x / varParamDis * GameServices.configService.playerConfig.xDirMaxDis;
}
//向右滑
if (dir.x < 0)
{
varPos.x += dir.x / varParamDis * GameServices.configService.playerConfig.xDirMinDis;
}
//向上滑
if (dir.y < 0)
{
varPos.z += dir.y / varParamDis * GameServices.configService.playerConfig.yDirMinDis;
}
//向下滑
if (dir.y > 0)
{
varPos.z -= dir.y / varParamDis * GameServices.configService.playerConfig.yDirMaxDis;
}
varPos.y = m_topPosY;
m_topTrans.position = varPos;
}
private void OnDestroy()
{
if (GameServices.inputService != null)
{
GameServices.inputService.pad.onMoveVec3 -= OnMove;
}
}
}
//public class ChainDragView : MonoBehaviour
//{
// public Transform m_topTrans;
// private float m_topPosY;
// private void Start()
// {
// m_topPosY = m_topTrans.position.y;
// GameServices.inputService.pad.onMoveVec3 += OnMove;
// }
// //移动
// void OnMove(Vector3 dir)
// {
// float varParamDis = Screen.width * 0.8f / 2;//参数距离
// Vector3 varPos = m_topTrans.position;
// //向左滑
// if (dir.x > 0)
// {
// varPos.x -= dir.x / varParamDis * GameServices.configService.playerConfig.xDirMaxDis;
// }
// //向右滑
// if (dir.x < 0)
// {
// varPos.x += dir.x / varParamDis * GameServices.configService.playerConfig.xDirMinDis;
// }
// //向上滑
// if (dir.y < 0)
// {
// varPos.z += dir.y / varParamDis * GameServices.configService.playerConfig.yDirMinDis;
// }
// //向下滑
// if (dir.y > 0)
// {
// varPos.z -= dir.y / varParamDis * GameServices.configService.playerConfig.yDirMaxDis;
// }
// varPos.y = m_topPosY;
// m_topTrans.position = varPos;
// }
// private void OnDestroy()
// {
// if (GameServices.inputService != null)
// {
// GameServices.inputService.pad.onMoveVec3 -= OnMove;
// }
// }
//}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
//using System.Collections;
//using System.Collections.Generic;
//using UnityEngine;
public class CameraMove : MonoBehaviour
{
private float m_PosY;
private float m_FieldView;
private Camera m_camera;
// Start is called before the first frame update
void Start()
{
m_camera = gameObject.GetComponent<Camera>();
m_PosY = transform.position.y;
m_FieldView = m_camera.fieldOfView;
BattleCtrl.instance.battleUI.onPosUpBtn = CameraPosUp;
BattleCtrl.instance.battleUI.onPosDownBtn = CameraPosDown;
BattleCtrl.instance.battleUI.onFieldFarBtn = CameraFieldFar;
BattleCtrl.instance.battleUI.onFieldNearBtn = CameraFieldNear;
}
//镜头拉上
void CameraPosUp()
{
Vector3 varVec = transform.position;
varVec.y += Time.deltaTime * GameServices.configService.playerConfig.cameraMoveSpeed;
transform.position = varVec;
}
//镜头拉下
void CameraPosDown()
{
Vector3 varVec = transform.position;
varVec.y -= Time.deltaTime * GameServices.configService.playerConfig.cameraMoveSpeed;
transform.position = varVec;
}
//镜头拉远
void CameraFieldFar()
{
m_camera.fieldOfView += Time.deltaTime * GameServices.configService.playerConfig.cameraFieldSpeed;
}
//镜头拉近
void CameraFieldNear()
{
m_camera.fieldOfView -= Time.deltaTime * GameServices.configService.playerConfig.cameraFieldSpeed;
}
}
//public class CameraMove : MonoBehaviour
//{
// private float m_PosY;
// private float m_FieldView;
// private Camera m_camera;
// // Start is called before the first frame update
// void Start()
// {
// m_camera = gameObject.GetComponent<Camera>();
// m_PosY = transform.position.y;
// m_FieldView = m_camera.fieldOfView;
// BattleCtrl.instance.battleUI.onPosUpBtn = CameraPosUp;
// BattleCtrl.instance.battleUI.onPosDownBtn = CameraPosDown;
// BattleCtrl.instance.battleUI.onFieldFarBtn = CameraFieldFar;
// BattleCtrl.instance.battleUI.onFieldNearBtn = CameraFieldNear;
// }
// //镜头拉上
// void CameraPosUp()
// {
// Vector3 varVec = transform.position;
// varVec.y += Time.deltaTime * GameServices.configService.playerConfig.cameraMoveSpeed;
// transform.position = varVec;
// }
// //镜头拉下
// void CameraPosDown()
// {
// Vector3 varVec = transform.position;
// varVec.y -= Time.deltaTime * GameServices.configService.playerConfig.cameraMoveSpeed;
// transform.position = varVec;
// }
// //镜头拉远
// void CameraFieldFar()
// {
// m_camera.fieldOfView += Time.deltaTime * GameServices.configService.playerConfig.cameraFieldSpeed;
// }
// //镜头拉近
// void CameraFieldNear()
// {
// m_camera.fieldOfView -= Time.deltaTime * GameServices.configService.playerConfig.cameraFieldSpeed;
// }
//}
......@@ -10,14 +10,14 @@ using UnityEngine.Profiling;
public class LevelCtrl : MonoBehaviour
{
public ChainView m_chainView;//爪钩view
public ChainRopeView m_chainRopeView;//娃娃机爪钩
//public ChainView m_chainView;//爪钩view
//public ChainRopeView m_chainRopeView;//娃娃机爪钩
public Camera m_camera;
public BombView m_bombView;//炸弹view
public CarView m_carView;//车
//public TargetView m_targetView;//触发器
public ChainView chainView => m_chainView;
public ChainRopeView chainRopeView => m_chainRopeView;
//public ChainView chainView => m_chainView;
//public ChainRopeView chainRopeView => m_chainRopeView;
public Camera cam => m_camera;
public BombView bombView => m_bombView;
public CarView carView => m_carView;
......
......@@ -112,52 +112,52 @@ public class AudioServices : MonoBehaviour
}
}
public void PlayAudio(AudioClip clip, bool isLoop = false, Action onPlayEnd = null)
{
if (LocalRecord.HasKey(GlobalConfig.SoundKey) && LocalRecord.GetIntRecord(GlobalConfig.SoundKey) == 0)
{
return;
}
AudioSource source = GetSource();
source.clip = clip;
source.loop = isLoop;
source.volume = GlobalConfig.isEnableSound ? 1 : 0; //根据全局配置设置音量
//public void PlayAudio(AudioClip clip, bool isLoop = false, Action onPlayEnd = null)
//{
// if (LocalRecord.HasKey(GlobalConfig.SoundKey) && LocalRecord.GetIntRecord(GlobalConfig.SoundKey) == 0)
// {
// return;
// }
// AudioSource source = GetSource();
// source.clip = clip;
// source.loop = isLoop;
// source.volume = GlobalConfig.isEnableSound ? 1 : 0; //根据全局配置设置音量
source.Play();
GameServices.timerServices.Push(this, source.clip.length, delegate {
RecycleSource(source);
onPlayEnd?.Invoke();
});
}
public AudioSource GetPlayAudioSource(AudioClip clip)
{
if (LocalRecord.HasKey(GlobalConfig.SoundKey) && LocalRecord.GetIntRecord(GlobalConfig.SoundKey) == 0)
{
return null;
}
AudioSource source = GetSource();
source.clip = clip;
source.loop = true;
source.volume = GlobalConfig.isEnableSound ? 1 : 0; //根据全局配置设置音量
source.Play();
return source;
}
public void AudioPlayFinished(AudioSource source)
{
if (LocalRecord.HasKey(GlobalConfig.SoundKey) && LocalRecord.GetIntRecord(GlobalConfig.SoundKey) == 0)
{
return;
}
RecycleSource(source);
}
private IEnumerator AudioPlayFinished(AudioSource source, float time, Action callback)
{
yield return new WaitForSeconds(time);
RecycleSource(source);
callback?.Invoke();
}
// source.Play();
// GameServices.timerServices.Push(this, source.clip.length, delegate {
// RecycleSource(source);
// onPlayEnd?.Invoke();
// });
//}
//public AudioSource GetPlayAudioSource(AudioClip clip)
//{
// if (LocalRecord.HasKey(GlobalConfig.SoundKey) && LocalRecord.GetIntRecord(GlobalConfig.SoundKey) == 0)
// {
// return null;
// }
// AudioSource source = GetSource();
// source.clip = clip;
// source.loop = true;
// source.volume = GlobalConfig.isEnableSound ? 1 : 0; //根据全局配置设置音量
// source.Play();
// return source;
//}
//public void AudioPlayFinished(AudioSource source)
//{
// if (LocalRecord.HasKey(GlobalConfig.SoundKey) && LocalRecord.GetIntRecord(GlobalConfig.SoundKey) == 0)
// {
// return;
// }
// RecycleSource(source);
//}
//private IEnumerator AudioPlayFinished(AudioSource source, float time, Action callback)
//{
// yield return new WaitForSeconds(time);
// RecycleSource(source);
// callback?.Invoke();
//}
private void OnDestroy()
{
......
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System;
#if UNITY_EDITOR
using UnityEditor;
#endif
//using System.Collections;
//using System.Collections.Generic;
//using UnityEngine;
//using System;
//#if UNITY_EDITOR
//using UnityEditor;
//#endif
public class BattleConfig : ScriptableObject
{
public PlayerConfig playerConfig;
public LevelConfig levelConfig;
public AudioConfig audioConfig;
//public class BattleConfig : ScriptableObject
//{
// public PlayerConfig playerConfig;
// public LevelConfig levelConfig;
// public AudioConfig audioConfig;
#if UNITY_EDITOR
[MenuItem("Tools/Rope/生成战斗配置")]
public static void GenBattleConfig()
{
string savePath = @"Assets/Resources/BattleConfig.asset";
var data = ScriptableObject.CreateInstance("BattleConfig");
AssetDatabase.CreateAsset(data, savePath);
}
#endif
//#if UNITY_EDITOR
// [MenuItem("Tools/Rope/生成战斗配置")]
// public static void GenBattleConfig()
// {
// string savePath = @"Assets/Resources/BattleConfig.asset";
// var data = ScriptableObject.CreateInstance("BattleConfig");
// AssetDatabase.CreateAsset(data, savePath);
// }
//#endif
/// <summary>
/// 加载配置
/// </summary>
/// <returns></returns>
public static BattleConfig LoadConfig()
{
return Resources.Load<BattleConfig>("BattleConfig");
}
}
// /// <summary>
// /// 加载配置
// /// </summary>
// /// <returns></returns>
// public static BattleConfig LoadConfig()
// {
// return Resources.Load<BattleConfig>("BattleConfig");
// }
//}
[Serializable]
public class PlayerConfig
{
[Header("手移动的速度")]
public float moveSpeed = 6;
[Header("X方向最小距离")]
public float xDirMinDis = -5;
[Header("X方向最大距离")]
public float xDirMaxDis = 5;
[Header("Z方向最小距离")]
public float yDirMinDis = -5;
[Header("Z方向最大距离")]
public float yDirMaxDis = 5;
[Header("爪的最大角度")]
public float clawMaxAngle = 30.0f;
[Header("爪的旋转速度")]
public float clawRotateSpeed = 20.0f;
[Header("绳子缩减的速度")]
public float ropeReduceSpeed = 2.0f;
[Header("绳子伸长的速度")]
public float ropeExtendSpeed = 3.0f;
[Header("爪身的旋转速度")]
public float clawBodyRotateSpeed = 2.0f;
[Header("镜头移动速度")]
public float cameraMoveSpeed = 2;
[Header("镜头远近速度")]
public float cameraFieldSpeed = 2;
//[Serializable]
//public class PlayerConfig
//{
// [Header("手移动的速度")]
// public float moveSpeed = 6;
// [Header("X方向最小距离")]
// public float xDirMinDis = -5;
// [Header("X方向最大距离")]
// public float xDirMaxDis = 5;
// [Header("Z方向最小距离")]
// public float yDirMinDis = -5;
// [Header("Z方向最大距离")]
// public float yDirMaxDis = 5;
// [Header("爪的最大角度")]
// public float clawMaxAngle = 30.0f;
// [Header("爪的旋转速度")]
// public float clawRotateSpeed = 20.0f;
// [Header("绳子缩减的速度")]
// public float ropeReduceSpeed = 2.0f;
// [Header("绳子伸长的速度")]
// public float ropeExtendSpeed = 3.0f;
// [Header("爪身的旋转速度")]
// public float clawBodyRotateSpeed = 2.0f;
// [Header("镜头移动速度")]
// public float cameraMoveSpeed = 2;
// [Header("镜头远近速度")]
// public float cameraFieldSpeed = 2;
//爪子移动速度
public float ClawMoveSpeed { get; set; }
}
[Serializable]
public class LevelConfig
{
[Header("关卡3的地面位置")]
public float landPosY = 1.9f;
[Header("第一关目标名称")]
public string firstLevelGoalName = "Tree_Star";
[Header("第二关目标名称")]
public string secondLevelGoalName = "Boy_01";
[Header("第三关目标名称")]
public string thirdLevelGoalName = "Boy_02";
[Header("第四关目标名称")]
public string fourthLevelGoalName = "SM_Prop_Crate_03 (2)";
[Header("第五关目标名称")]
public string fifthLevelGoalName1 = "BlueDark_BunnyBalloon";
public string fifthLevelGoalName2 = "SM_Icon_Sword_01";
public string fifthLevelGoalName3 = "SM_Primitive_Sphere_02";
[Header("第六关目标名称")]
public string sixthLevelGoalName = "SM_Primitive_Pyramid_01";
[Header("第七关目标名称")]
public string seventhLevelGoalName = "SM_Primitive_Cube_04 (1)";
}
[Serializable]
public class AudioConfig
{
[Header("失败音效列表")]
public List<AudioClip> failList;
[Header("游戏bmg")]
public AudioClip GameBgm;
// //爪子移动速度
// public float ClawMoveSpeed { get; set; }
//}
//[Serializable]
//public class LevelConfig
//{
// [Header("关卡3的地面位置")]
// public float landPosY = 1.9f;
// [Header("第一关目标名称")]
// public string firstLevelGoalName = "Tree_Star";
// [Header("第二关目标名称")]
// public string secondLevelGoalName = "Boy_01";
// [Header("第三关目标名称")]
// public string thirdLevelGoalName = "Boy_02";
// [Header("第四关目标名称")]
// public string fourthLevelGoalName = "SM_Prop_Crate_03 (2)";
// [Header("第五关目标名称")]
// public string fifthLevelGoalName1 = "BlueDark_BunnyBalloon";
// public string fifthLevelGoalName2 = "SM_Icon_Sword_01";
// public string fifthLevelGoalName3 = "SM_Primitive_Sphere_02";
// [Header("第六关目标名称")]
// public string sixthLevelGoalName = "SM_Primitive_Pyramid_01";
// [Header("第七关目标名称")]
// public string seventhLevelGoalName = "SM_Primitive_Cube_04 (1)";
//}
//[Serializable]
//public class AudioConfig
//{
// [Header("失败音效列表")]
// public List<AudioClip> failList;
// [Header("游戏bmg")]
// public AudioClip GameBgm;
[Header("胜利")]
public AudioClip Success;
// [Header("胜利")]
// public AudioClip Success;
[Header("爪子下降或者上升")]
public AudioClip clawDownOrUp;
/// <summary>
/// 获取随机一个失败叫声
/// </summary>
/// <returns></returns>
public AudioClip GetFail()
{
int index = UnityEngine.Random.Range(0, failList.Count);
return failList[index];
}
}
// [Header("爪子下降或者上升")]
// public AudioClip clawDownOrUp;
// /// <summary>
// /// 获取随机一个失败叫声
// /// </summary>
// /// <returns></returns>
// public AudioClip GetFail()
// {
// int index = UnityEngine.Random.Range(0, failList.Count);
// return failList[index];
// }
//}
......@@ -5,12 +5,12 @@ using UnityEngine;
public class ConfigServices : BaseServices
{
public BattleConfig config;
//public BattleConfig config;
public override void OnStart()
{
base.OnStart();
config = BattleConfig.LoadConfig();
//config = BattleConfig.LoadConfig();
servicesEnable = true;
}
}
\ No newline at end of file
......@@ -21,7 +21,7 @@ public class GameServices : MonoBehaviour
/// <summary>
/// 战斗配置服务
/// </summary>
public static BattleConfig configService => _ConfigService.config;
//public static BattleConfig configService => _ConfigService.config;
/// <summary>
/// 计时器服务
......
fileFormatVersion: 2
guid: 988d4f82fb2c0ee49af6836de40fd04f
guid: 317d19313d1d7204e9bbc37122116e7f
folderAsset: yes
DefaultImporter:
externalObjects: {}
......
fileFormatVersion: 2
guid: 911c6a0aabc57ab4280dfa49390aaf69
guid: ca40beb7fc6998f40a6e15a59c6ab599
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
......
fileFormatVersion: 2
guid: d967723201452894680314048a609a92
guid: 325c11e064841204bbd6de7c85bebef6
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
......
fileFormatVersion: 2
guid: 31e6a095f36d9344dafe30febb77c5ef
NativeFormatImporter:
guid: aa43ce62596b0784081ec9bd0abc8516
folderAsset: yes
DefaultImporter:
externalObjects: {}
mainObjectFileID: 0
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 2e117c0bfc6741e4ebc4a8c8aebc0b8a
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 55c4962f2a6593c4b9c1bb6003b1ff08
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
This diff is collapsed.
......@@ -40,7 +40,7 @@ Material:
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 2800000, guid: 86cb957541c7c8542a6306ffb82e6833, type: 3}
m_Texture: {fileID: 2800000, guid: e6bcefb2a2fea3442809925e5d4fe224, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
......
......@@ -19,8 +19,7 @@ public class AIMove : MonoBehaviour
public float HSpeed = 10.0f;
public int SpeedLevel = 1;
public float AddSpeed = 10.0f;
[Tooltip("AI移动方式")]
public MoveType moveType = MoveType.MoveType3;
[Tooltip("游戏结束每秒减少的速度")]
public float deceleration = 15;
......@@ -453,25 +452,8 @@ public class AIMove : MonoBehaviour
void UpdateJoystick()
{
print("摇杆控制左右");
switch (moveType)
{
case MoveType.MoveType1:
MoveType1(); //阻尼的形式
break;
case MoveType.MoveType2:
MoveType2(); //乱飘的形式
break;
case MoveType.MoveType3:
MoveType3(); //比较生硬的形式
break;
default:
MoveType3(); //比较生硬的形式
break;
}
//MoveType1(); //阻尼的形式
//MoveType2(); //乱飘的形式
//MoveType3(); //比较生硬的形式
MoveType3(); //比较生硬的形式
}
public void MoveType1()
......
fileFormatVersion: 2
guid: 181349c69b40ac84eb8897eebf413d78
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class RandomFood : MonoBehaviour
{
public int foodNumber = 10;
public List<Transform> foodPoint;
public List<GameObject> foods;
void Start()
{
GenerateRandomFood(10);
}
// Update is called once per frame
void Update()
{
GameObject[] currFoods= GameObject.FindGameObjectsWithTag("Food");
if (currFoods.Length == 0)
{
GenerateRandomFood(10);
}
}
/// <summary>
/// 生成number个随机食物
/// </summary>
/// <param name="number"></param>
public void GenerateRandomFood(int number)
{
for (int i = 0; i < number; i++)
{
GameObject obj = getRandomFoodObj();
Transform foodParent = getRandomPos();
Instantiate(obj, foodParent.position, foodParent.rotation, foodParent);
}
}
private Transform getRandomPos()
{
return foodPoint[Random.Range(0, foodPoint.Count)];
}
private GameObject getRandomFoodObj()
{
return foods[Random.Range(0, foods.Count)];
}
}
fileFormatVersion: 2
guid: 302f094fe9e75cb4cbc0ebddc6c24c98
guid: 88224c51f1a97cf40895dff846d2a5b3
MonoImporter:
externalObjects: {}
serializedVersion: 2
......
......@@ -72,10 +72,10 @@ public class Enemy_Vertigo : MonoBehaviour
if (hit.collider.tag == "Player")
{
life--;
hit.gameObject.GetComponent<PlayerMove>().Vertigo(VertigoTime);//眩晕1秒
//hit.gameObject.GetComponent<PlayerMove>().Vertigo(VertigoTime);//眩晕1秒
//hit.gameObject.GetComponent<PlayerMove>().ChangeSpeedLevel(-1); //等级降低一级
//print("减速前:"+ hit.gameObject.GetComponent<PlayerMove>().SpeedLevel);
hit.gameObject.GetComponent<PlayerMove>().ChangeSpeedLevelToPrevMaxLevelAndChangeModel(); //等级降低到上一级
// hit.gameObject.GetComponent<PlayerMove>().ChangeSpeedLevelToPrevMaxLevelAndChangeModel(); //等级降低到上一级
//print("减速后:" + hit.gameObject.GetComponent<PlayerMove>().SpeedLevel);
Destroy(gameObject);
}
......
......@@ -48,10 +48,10 @@ public class GiantRock : MonoBehaviour
if (hit.collider.tag == "Player")
{
life--;
hit.gameObject.GetComponent<PlayerMove>().Vertigo(VertigoTime);//眩晕1秒
//hit.gameObject.GetComponent<PlayerMove>().Vertigo(VertigoTime);//眩晕1秒
//hit.gameObject.GetComponent<PlayerMove>().ChangeSpeedLevel(-1); //等级降低一级
//print("减速前:"+ hit.gameObject.GetComponent<PlayerMove>().SpeedLevel);
hit.gameObject.GetComponent<PlayerMove>().ChangeSpeedLevelToPrevMaxLevelAndChangeModel(); //等级降低到上一级
//hit.gameObject.GetComponent<PlayerMove>().ChangeSpeedLevelToPrevMaxLevelAndChangeModel(); //等级降低到上一级
//print("减速后:" + hit.gameObject.GetComponent<PlayerMove>().SpeedLevel);
Destroy(gameObject);
}
......
This diff is collapsed.
This diff is collapsed.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
/// <summary>
/// 模拟轨迹
/// </summary>
public class TestChinarForece : MonoBehaviour
{
public Transform DirectionBall; //指向方向的球
public Transform TrackBallTransform; //轨迹球
private Rigidbody trackBallRigidbody; //
public Slider VelocitySlider; //力度值 滑动器
public Slider AngleSlider; //角度值
private PhysicsScene physicsScene; //物理场景
public GameObject[] OtherGameObjects; //所有小球
public int TrackFrames = 80; //轨迹帧率
private int ICount; //对象计数
private float timer;
/// <summary>
/// 对象池字典
/// </summary>
private readonly Dictionary<int, Transform> goDict = new Dictionary<int, Transform>();
void Start()
{
AngleSlider.onValueChanged.AddListener(OnValueChanged);
trackBallRigidbody = TrackBallTransform.GetComponent<Rigidbody>(); //TrackBall 有rigibody
Physics.autoSimulation = false;
CreatePhysicsScene(); //该脚本只实例化一次。
GeneratePool();
}
/// <summary>
/// 创建一个用于模拟的场景
/// </summary>
private void CreatePhysicsScene()
{
print("创建指向模拟场景");
var scene = SceneManager.CreateScene("指向模拟场景");
physicsScene = scene.GetPhysicsScene();
SceneManager.MoveGameObjectToScene(DirectionBall.parent.gameObject, scene); //DirBall 有parent
for (int i = 3; i < OtherGameObjects.Length; i++)
{
SceneManager.MoveGameObjectToScene(OtherGameObjects[i], scene);
}
}
/// <summary>
/// 生成池子
/// 轨迹球 重复利用
/// </summary>
private void GeneratePool()
{
var GoPoolPos = new Vector3(100, 100, 100);
for (int i = 0; i < TrackFrames; i++)
{
var iclone = Instantiate(TrackBallTransform); //TrackBallTransform
iclone.position = GoPoolPos;
iclone.localScale = Vector3.one * 0.5f;
goDict.Add(i, iclone);
}
}
/// <summary>
/// 重置球位置
/// 其他球要隐形的
/// </summary>
private void resetOtherBall()
{
for (int i = 0; i < 3; i++)
{
OtherGameObjects[i + 3].transform.position = OtherGameObjects[i].transform.position;
}
}
/// <summary>
/// 角度发生改变时
/// </summary>
public void OnValueChanged(float value)
{
Physics.autoSimulation = false; //关闭 物理模拟
TrackBallTransform.position = transform.position;
trackBallRigidbody.velocity = Vector3.zero;
DirectionBall.parent.rotation = Quaternion.Euler(0, value, 0);
Vector3 vector3 = DirectionBall.position - transform.position;
trackBallRigidbody.AddForce(vector3 * VelocitySlider.value);
for (int i = 0; i < TrackFrames; i++)
{
physicsScene.Simulate(0.02f);
GoPool().position = TrackBallTransform.position;
}
}
/// <summary>
/// 简化版对象池
/// 每次调用返回一个新对象
/// </summary>
private Transform GoPool()
{
ICount++;
if (ICount == TrackFrames - 1)
{
ICount = 0;
}
return goDict[ICount];
}
void Update()
{
if (!EventSystem.current.IsPointerOverGameObject())
{
if (Input.GetMouseButtonUp(0))
{
Physics.autoSimulation = true;
Vector3 vector3 = DirectionBall.position - transform.position;
GetComponent<Rigidbody>().AddForce(vector3 * VelocitySlider.value); //当前脚本挂着物体有rigibody
}
}
}
}
fileFormatVersion: 2
guid: b916ff68118d37146a6621eeaf667437
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
This diff is collapsed.
This diff is collapsed.
fileFormatVersion: 2
guid: 45b864dd5621c044d92aa9ab676979d3
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class TestTrigger : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
print(111);
}
private void OnTriggerEnter(Collider other)
{
print(other);
}
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
C:\Program Files\Java\jre1.8.0_74\bin>keytool -exportcert -alias androiddebugkey -keystore D:\Android_keystore\user.keystore | C:\openss1-0.9.8k_X64\bin\openssl shal -binary |C:\openssl-0.9.8k_X64\bin\openssl base64
mBiKXr2MyG2TrTkTYfnKF/eLFuM=
com.facebook.unity.FBUnityDeepLinkingActivity
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