Commit 11fd03c6 authored by czy's avatar czy

Bug修复

parent d98d53a5
...@@ -408,14 +408,14 @@ public class BattleUI : MonoBehaviour ...@@ -408,14 +408,14 @@ public class BattleUI : MonoBehaviour
//摇杆图标出现 //摇杆图标出现
public void ShowJoystick() public void ShowJoystick()
{ {
print("显示摇杆"); //print("显示摇杆");
m_joystickImage.color = Color.white; m_joystickImage.color = Color.white;
m_thumbImage.color = Color.white; m_thumbImage.color = Color.white;
} }
//摇杆图标隐藏 //摇杆图标隐藏
public void HideJoystick() public void HideJoystick()
{ {
print("隐藏摇杆"); //print("隐藏摇杆");
m_joystickImage.color = Color.clear; m_joystickImage.color = Color.clear;
m_thumbImage.color = Color.clear; m_thumbImage.color = Color.clear;
} }
......
...@@ -1028,7 +1028,7 @@ AnimationClip: ...@@ -1028,7 +1028,7 @@ AnimationClip:
m_Level: 0 m_Level: 0
m_CycleOffset: 0 m_CycleOffset: 0
m_HasAdditiveReferencePose: 0 m_HasAdditiveReferencePose: 0
m_LoopTime: 0 m_LoopTime: 1
m_LoopBlend: 0 m_LoopBlend: 0
m_LoopBlendOrientation: 0 m_LoopBlendOrientation: 0
m_LoopBlendPositionY: 0 m_LoopBlendPositionY: 0
......
...@@ -428,7 +428,7 @@ AnimatorStateTransition: ...@@ -428,7 +428,7 @@ AnimatorStateTransition:
m_Name: m_Name:
m_Conditions: m_Conditions:
- m_ConditionMode: 2 - m_ConditionMode: 2
m_ConditionEvent: Punch m_ConditionEvent: Push
m_EventTreshold: 0 m_EventTreshold: 0
m_DstStateMachine: {fileID: 0} m_DstStateMachine: {fileID: 0}
m_DstState: {fileID: 0} m_DstState: {fileID: 0}
......
This diff is collapsed.
This diff is collapsed.
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
public class PlayerAttack : MonoBehaviour public class Attack : MonoBehaviour
{ {
// Start is called before the first frame update // Start is called before the first frame update
...@@ -18,10 +18,10 @@ public class PlayerAttack : MonoBehaviour ...@@ -18,10 +18,10 @@ public class PlayerAttack : MonoBehaviour
} }
public void AttackLeft() public void AttackLeft()
{ {
print(gameObject.name+":左手攻击"); //print(gameObject.name+":左手攻击");
} }
public void AttackRight() public void AttackRight()
{ {
print(gameObject.name + ":右手攻击"); //print(gameObject.name + ":右手攻击");
} }
} }
...@@ -4,9 +4,11 @@ using UnityEngine; ...@@ -4,9 +4,11 @@ using UnityEngine;
public class AttackTrigger : MonoBehaviour public class AttackTrigger : MonoBehaviour
{ {
private bool Punch = false;
private bool Push = false;
public Animator animator; public Animator animator;
public string OtherTag= "Competitor";
public GameObject targetWall;
void Start() void Start()
{ {
} }
...@@ -18,36 +20,43 @@ public class AttackTrigger : MonoBehaviour ...@@ -18,36 +20,43 @@ public class AttackTrigger : MonoBehaviour
} }
private void OnTriggerEnter(Collider other) private void OnTriggerEnter(Collider other)
{ {
print(other.name); //print("进入。" + other.name);
if (other.tag == "Competitor") if (other.tag == OtherTag)//if (other.tag == "Competitor")
{ {
Punch = true; ChangeAnimationPunchState(true);
animator.SetBool("Punch", Punch); }
animator.SetLayerWeight(1, 1); else if(other.gameObject == targetWall)
}else if(other.tag == "Wall")
{ {
Push = true; ChangeAnimationPushState(true);
animator.SetBool("Push", Push);
animator.SetLayerWeight(1, 1);
} }
} }
private void OnTriggerExit(Collider other) private void OnTriggerExit(Collider other)
{ {
print(other.name); //print(other.name);
if (other.tag == "Competitor") //print("退出。"+ other.name);
if (other.tag == OtherTag)
{ {
Punch = false; ChangeAnimationPunchState(false);
animator.SetBool("Punch", Punch); }
animator.SetLayerWeight(1, 0); else if(other.gameObject == targetWall)
}else if(other.tag == "Wall")
{ {
Push = false; ChangeAnimationPushState(false);
animator.SetBool("Push", Push);
animator.SetLayerWeight(1, 0);
} }
} }
//Push
public void ChangeAnimationPushState(bool isPush)
{
animator.SetBool("Push", isPush);
animator.SetLayerWeight(1, isPush?1:0);
}
//punch
public void ChangeAnimationPunchState(bool isPunch)
{
animator.SetBool("Punch", isPunch);
animator.SetLayerWeight(1, isPunch ? 1 : 0);
}
} }
...@@ -47,9 +47,6 @@ public class PlayerMove : MonoBehaviour ...@@ -47,9 +47,6 @@ public class PlayerMove : MonoBehaviour
private float timer = 0.0f; private float timer = 0.0f;
//输入控制player移动的中间变量 //输入控制player移动的中间变量
private float addXTemp = 0;
private float targetX;
private Vector3 movement = Vector3.zero;
private float _vertSpeed = 0.0f; private float _vertSpeed = 0.0f;
private float xDelta=0.0f; private float xDelta=0.0f;
private float yDelta = 0; private float yDelta = 0;
...@@ -66,7 +63,9 @@ public class PlayerMove : MonoBehaviour ...@@ -66,7 +63,9 @@ public class PlayerMove : MonoBehaviour
//最大速度等级 //最大速度等级
private int MaxSpeedLevel = 15;//1-15 分为 1-5 6-10 11-15 private int MaxSpeedLevel = 15;//1-15 分为 1-5 6-10 11-15
public GameObject targetWall;
...@@ -109,7 +108,7 @@ public class PlayerMove : MonoBehaviour ...@@ -109,7 +108,7 @@ public class PlayerMove : MonoBehaviour
//BattleUI.instance.GenerateAddMoneyUI(100, screenPoint); //BattleUI.instance.GenerateAddMoneyUI(100, screenPoint);
//Destroy(other.gameObject); //Destroy(other.gameObject);
print("吃到食物。"); //print("吃到食物。");
power+=0.3f; power+=0.3f;
Scale(power,power,power); Scale(power,power,power);
Destroy(other.gameObject); Destroy(other.gameObject);
...@@ -117,9 +116,9 @@ public class PlayerMove : MonoBehaviour ...@@ -117,9 +116,9 @@ public class PlayerMove : MonoBehaviour
} }
private void OnControllerColliderHit(ControllerColliderHit hit) private void OnControllerColliderHit(ControllerColliderHit hit)
{ {
if (hit.gameObject.tag == "Wall") if (hit.gameObject== targetWall)
{ {
print("碰到墙"); //print("碰到墙");
if (power>1) if (power>1)
{ {
hit.gameObject.GetComponent<Rigidbody>().AddForce(new Vector3(0, 0, 100)); hit.gameObject.GetComponent<Rigidbody>().AddForce(new Vector3(0, 0, 100));
...@@ -304,8 +303,15 @@ public class PlayerMove : MonoBehaviour ...@@ -304,8 +303,15 @@ public class PlayerMove : MonoBehaviour
} }
} }
//推墙
if (targetWall == null)
{
//游戏失败
animator.SetBool("Push", false);
}
} }
//摇杆控制 //摇杆控制
......
using System.Collections; //using System.Collections;
using System.Collections.Generic; //using System.Collections.Generic;
using UnityEngine; //using UnityEngine;
public class Enemy_Vertigo : MonoBehaviour //public class Enemy_Vertigo : MonoBehaviour
{ //{
public float VSpeed = 40.0f; // public float VSpeed = 40.0f;
public int SpeedLevel = 1; // public int SpeedLevel = 1;
public float AddSpeed = 10.0f; // public float AddSpeed = 10.0f;
public float VertigoTime = 3.0f; // public float VertigoTime = 3.0f;
private Transform targetPos;//目标点 // private Transform targetPos;//目标点
private CharacterController characterController; // private CharacterController characterController;
//动画 // //动画
private Animator animator; // private Animator animator;
//状态 // //状态
private float MoveSpeed = 0.0f; // private float MoveSpeed = 0.0f;
private bool Grounded = false; // private bool Grounded = false;
private int life = 1; // private int life = 1;
void Start() // void Start()
{ // {
characterController = this.GetComponent<CharacterController>(); // characterController = this.GetComponent<CharacterController>();
targetPos = DoRanking._instance.rankingList[2].transform; // targetPos = DoRanking._instance.rankingList[2].transform;
//获取animator组件 // //获取animator组件
animator = GetComponentInChildren<Animator>(); // animator = GetComponentInChildren<Animator>();
} // }
// Update is called once per frame // // Update is called once per frame
void Update() // void Update()
{ // {
//读取配置文件数据 // //读取配置文件数据
VSpeed = ConfigurationFile.instance.VSpeedEnemy_V; // VSpeed = ConfigurationFile.instance.VSpeedEnemy_V;
SpeedLevel = ConfigurationFile.instance.SpeedLevelEnemy_V; // SpeedLevel = ConfigurationFile.instance.SpeedLevelEnemy_V;
AddSpeed= ConfigurationFile.instance.AddSpeedEnemy_V; // AddSpeed= ConfigurationFile.instance.AddSpeedEnemy_V;
VertigoTime = ConfigurationFile.instance.VertigoTimeEnemy_V; // VertigoTime = ConfigurationFile.instance.VertigoTimeEnemy_V;
//移动 // //移动
MoveSpeed = VSpeed + AddSpeed * (SpeedLevel-1); // MoveSpeed = VSpeed + AddSpeed * (SpeedLevel-1);
//是否在地面 // //是否在地面
Grounded = characterController.isGrounded; // Grounded = characterController.isGrounded;
animator.SetFloat("MoveSpeed", MoveSpeed); // animator.SetFloat("MoveSpeed", MoveSpeed);
animator.SetBool("Grounded", Grounded); // animator.SetBool("Grounded", Grounded);
transform.LookAt(targetPos); // transform.LookAt(targetPos);
Vector3 direction = (targetPos.position - transform.position); // Vector3 direction = (targetPos.position - transform.position);
direction.y = 0; // direction.y = 0;
direction = direction.normalized; // direction = direction.normalized;
//characterController.SimpleMove(direction*Speed* SpeedLevel); // //characterController.SimpleMove(direction*Speed* SpeedLevel);
characterController.SimpleMove(direction * MoveSpeed); // characterController.SimpleMove(direction * MoveSpeed);
} // }
private void OnControllerColliderHit(ControllerColliderHit hit) // private void OnControllerColliderHit(ControllerColliderHit hit)
{ // {
if (life <= 0) // if (life <= 0)
{ // {
return; // return;
} // }
if (hit.collider.tag == "Competitor") // if (hit.collider.tag == "Competitor")
{ // {
life--; // life--;
hit.gameObject.GetComponent<AIMove>().Vertigo(VertigoTime);//眩晕1秒 // hit.gameObject.GetComponent<AIMove>().Vertigo(VertigoTime);//眩晕1秒
//hit.gameObject.GetComponent<AIMove>().ChangeSpeedLevel(-1); //等级降低一级 // //hit.gameObject.GetComponent<AIMove>().ChangeSpeedLevel(-1); //等级降低一级
hit.gameObject.GetComponent<AIMove>().ChangeSpeedLevelToPrevMaxLevelAndChangeModel(); //等级降低到上一级 // hit.gameObject.GetComponent<AIMove>().ChangeSpeedLevelToPrevMaxLevelAndChangeModel(); //等级降低到上一级
Destroy(gameObject); // Destroy(gameObject);
} // }
if (hit.collider.tag == "Player") // if (hit.collider.tag == "Player")
{ // {
life--; // life--;
//hit.gameObject.GetComponent<PlayerMove>().Vertigo(VertigoTime);//眩晕1秒 // //hit.gameObject.GetComponent<PlayerMove>().Vertigo(VertigoTime);//眩晕1秒
//hit.gameObject.GetComponent<PlayerMove>().ChangeSpeedLevel(-1); //等级降低一级 // //hit.gameObject.GetComponent<PlayerMove>().ChangeSpeedLevel(-1); //等级降低一级
//print("减速前:"+ hit.gameObject.GetComponent<PlayerMove>().SpeedLevel); // //print("减速前:"+ hit.gameObject.GetComponent<PlayerMove>().SpeedLevel);
// hit.gameObject.GetComponent<PlayerMove>().ChangeSpeedLevelToPrevMaxLevelAndChangeModel(); //等级降低到上一级 // // hit.gameObject.GetComponent<PlayerMove>().ChangeSpeedLevelToPrevMaxLevelAndChangeModel(); //等级降低到上一级
//print("减速后:" + hit.gameObject.GetComponent<PlayerMove>().SpeedLevel); // //print("减速后:" + hit.gameObject.GetComponent<PlayerMove>().SpeedLevel);
Destroy(gameObject); // Destroy(gameObject);
} // }
} // }
} //}
using System.Collections; //using System.Collections;
using System.Collections.Generic; //using System.Collections.Generic;
using UnityEngine; //using UnityEngine;
public class GiantRock : MonoBehaviour //public class GiantRock : MonoBehaviour
{ //{
public Transform ballModel; // public Transform ballModel;
[Tooltip("眩晕时长")] // [Tooltip("眩晕时长")]
public float VertigoTime=3; // public float VertigoTime=3;
private Vector3 moveDirection; // private Vector3 moveDirection;
private CharacterController characterController; // private CharacterController characterController;
private int life = 1; // private int life = 1;
void Start() // void Start()
{ // {
characterController = GetComponent<CharacterController>(); // characterController = GetComponent<CharacterController>();
} // }
// Update is called once per frame // // Update is called once per frame
void Update() // void Update()
{ // {
//配置文件读取数据 // //配置文件读取数据
VertigoTime = ConfigurationFile.instance.VertigoTimeGianRock; // VertigoTime = ConfigurationFile.instance.VertigoTimeGianRock;
//moveDirection = transform.TransformDirection(-Vector3.forward) * 10f * Time.deltaTime; // //moveDirection = transform.TransformDirection(-Vector3.forward) * 10f * Time.deltaTime;
moveDirection.z = -10 * Time.deltaTime; // moveDirection.z = -10 * Time.deltaTime;
moveDirection.y -= 9.81f * Time.deltaTime; // moveDirection.y -= 9.81f * Time.deltaTime;
characterController.Move(moveDirection); // characterController.Move(moveDirection);
ballModel.Rotate(-Vector3.right * 400 * Time.deltaTime); // ballModel.Rotate(-Vector3.right * 400 * Time.deltaTime);
} // }
private void OnControllerColliderHit(ControllerColliderHit hit) // private void OnControllerColliderHit(ControllerColliderHit hit)
{ // {
if (life <= 0) // if (life <= 0)
{ // {
return; // return;
} // }
if (hit.collider.tag == "Competitor") // if (hit.collider.tag == "Competitor")
{ // {
life--; // life--;
hit.gameObject.GetComponent<AIMove>().Vertigo(VertigoTime);//眩晕1秒 // hit.gameObject.GetComponent<AIMove>().Vertigo(VertigoTime);//眩晕1秒
//hit.gameObject.GetComponent<AIMove>().ChangeSpeedLevel(-1); //等级降低一级 // //hit.gameObject.GetComponent<AIMove>().ChangeSpeedLevel(-1); //等级降低一级
hit.gameObject.GetComponent<AIMove>().ChangeSpeedLevelToPrevMaxLevelAndChangeModel(); //等级降低到上一级 // hit.gameObject.GetComponent<AIMove>().ChangeSpeedLevelToPrevMaxLevelAndChangeModel(); //等级降低到上一级
Destroy(gameObject); // Destroy(gameObject);
} // }
if (hit.collider.tag == "Player") // if (hit.collider.tag == "Player")
{ // {
life--; // life--;
//hit.gameObject.GetComponent<PlayerMove>().Vertigo(VertigoTime);//眩晕1秒 // //hit.gameObject.GetComponent<PlayerMove>().Vertigo(VertigoTime);//眩晕1秒
//hit.gameObject.GetComponent<PlayerMove>().ChangeSpeedLevel(-1); //等级降低一级 // //hit.gameObject.GetComponent<PlayerMove>().ChangeSpeedLevel(-1); //等级降低一级
//print("减速前:"+ hit.gameObject.GetComponent<PlayerMove>().SpeedLevel); // //print("减速前:"+ hit.gameObject.GetComponent<PlayerMove>().SpeedLevel);
//hit.gameObject.GetComponent<PlayerMove>().ChangeSpeedLevelToPrevMaxLevelAndChangeModel(); //等级降低到上一级 // //hit.gameObject.GetComponent<PlayerMove>().ChangeSpeedLevelToPrevMaxLevelAndChangeModel(); //等级降低到上一级
//print("减速后:" + hit.gameObject.GetComponent<PlayerMove>().SpeedLevel); // //print("减速后:" + hit.gameObject.GetComponent<PlayerMove>().SpeedLevel);
Destroy(gameObject); // Destroy(gameObject);
} // }
} // }
} //}
...@@ -4,7 +4,9 @@ using UnityEngine; ...@@ -4,7 +4,9 @@ using UnityEngine;
public class Wall : MonoBehaviour public class Wall : MonoBehaviour
{ {
public AttackTrigger target;
public ParticleSystem ps; public ParticleSystem ps;
void Start() void Start()
{ {
...@@ -17,6 +19,7 @@ public class Wall : MonoBehaviour ...@@ -17,6 +19,7 @@ public class Wall : MonoBehaviour
particleSystem.gameObject.AddComponent<DestroyMySel>(); particleSystem.gameObject.AddComponent<DestroyMySel>();
particleSystem.transform.localScale = new Vector3(2,2,2); particleSystem.transform.localScale = new Vector3(2,2,2);
particleSystem.Play(); particleSystem.Play();
target.ChangeAnimationPushState(false);
Destroy(gameObject); Destroy(gameObject);
} }
} }
......
...@@ -6,6 +6,6 @@ EditorBuildSettings: ...@@ -6,6 +6,6 @@ EditorBuildSettings:
serializedVersion: 2 serializedVersion: 2
m_Scenes: m_Scenes:
- enabled: 1 - enabled: 1
path: Assets/#A1_Scenes/DemoScenes.unity path: Assets/Levels/Level 1.unity
guid: 6e58ccd9deab5cc45ab8336af516167e guid: 2c8bee72f3bc18b47b6957a0f91a2fbc
m_configObjects: {} m_configObjects: {}
...@@ -13,7 +13,7 @@ PlayerSettings: ...@@ -13,7 +13,7 @@ PlayerSettings:
useOnDemandResources: 0 useOnDemandResources: 0
accelerometerFrequency: 60 accelerometerFrequency: 60
companyName: Dyspace companyName: Dyspace
productName: StockRunning productName: BattleMuscle
defaultCursor: {fileID: 0} defaultCursor: {fileID: 0}
cursorHotspot: {x: 0, y: 0} cursorHotspot: {x: 0, y: 0}
m_SplashScreenBackgroundColor: {r: 0.13725491, g: 0.12156863, b: 0.1254902, a: 1} m_SplashScreenBackgroundColor: {r: 0.13725491, g: 0.12156863, b: 0.1254902, a: 1}
...@@ -119,7 +119,7 @@ PlayerSettings: ...@@ -119,7 +119,7 @@ PlayerSettings:
16:10: 1 16:10: 1
16:9: 1 16:9: 1
Others: 1 Others: 1
bundleVersion: 1.2 bundleVersion: 1.0
preloadedAssets: [] preloadedAssets: []
metroInputSource: 0 metroInputSource: 0
wsaTransparentSwapchain: 0 wsaTransparentSwapchain: 0
...@@ -250,7 +250,7 @@ PlayerSettings: ...@@ -250,7 +250,7 @@ PlayerSettings:
AndroidEnableTango: 0 AndroidEnableTango: 0
androidEnableBanner: 1 androidEnableBanner: 1
androidUseLowAccuracyLocation: 0 androidUseLowAccuracyLocation: 0
androidUseCustomKeystore: 1 androidUseCustomKeystore: 0
m_AndroidBanners: m_AndroidBanners:
- width: 320 - width: 320
height: 180 height: 180
...@@ -262,7 +262,7 @@ PlayerSettings: ...@@ -262,7 +262,7 @@ PlayerSettings:
- m_BuildTarget: - m_BuildTarget:
m_Icons: m_Icons:
- serializedVersion: 2 - serializedVersion: 2
m_Icon: {fileID: 2800000, guid: 6b722ef34e612f3469255b9a116681ac, type: 3} m_Icon: {fileID: 0}
m_Width: 128 m_Width: 128
m_Height: 128 m_Height: 128
m_Kind: 0 m_Kind: 0
......
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