Commit 11fd03c6 authored by czy's avatar czy

Bug修复

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