Commit 60565d35 authored by LiLiuZhou's avatar LiLiuZhou

1

parent abf592aa
......@@ -19,6 +19,8 @@ public class GameController : MonoBehaviour
public Transform Fruits;
public bool IsGameOver = false;
//准备销毁的水果集合
public LinkedList<GameObject> TempList = new LinkedList<GameObject>();
......
......@@ -37,6 +37,15 @@ public class Fruit : MonoBehaviour
private void OnCollisionEnter2D(Collision2D collision)
{
if (GameController.GetInstance().IsGameOver)
return;
if (rig2D.bodyType == RigidbodyType2D.Kinematic)
{
GameController.GetInstance().IsGameOver = true;
Debug.LogError("游戏结束");
}
if (collision.gameObject.CompareTag("Bottom"))
{
if (!BottomColiderIsCD)
......@@ -106,7 +115,7 @@ public class Fruit : MonoBehaviour
Vector2 Velocity =
gameObject.GetComponent<Rigidbody2D>().velocity.magnitude > collision.gameObject.GetComponent<Rigidbody2D>().velocity.magnitude?
gameObject.GetComponent<Rigidbody2D>().velocity : collision.gameObject.GetComponent<Rigidbody2D>().velocity;
Obj.GetComponent<Fruit>().rig2D = Obj.GetComponent<Rigidbody2D>();
Obj.GetComponent<Rigidbody2D>().velocity = Velocity;
#region 上报水果合成
......
using System;
#define Test
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
[RequireComponent(typeof(EventTrigger))]
public class TouchPanel : BasePanel
{
//相机
public Camera cam;
......@@ -122,8 +126,11 @@ public class TouchPanel : BasePanel
RequestNewFruitType();
return;
}
#if Test
int NowFruitType = 7;
#else
int NowFruitType = InstantFruitList.Dequeue();
#endif
NowFruit = GameObject.Instantiate(Resources.Load<GameObject>("Fruits/" + NowFruitType));
NowFruit.name = NowFruitType.ToString();
NowFruit.transform.position = new Vector3(0, GameController.GetInstance().RedLinePosY);
......
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