Skip to content

Commit

Permalink
修复了暂停后小鸟还能拖拽的Bug
Browse files Browse the repository at this point in the history
在点击暂停Button之后,将架台上待发射小鸟的canMove设为false,从而使小鸟不能拖拽
  • Loading branch information
KIPKIPS committed Mar 3, 2020
1 parent 4c50660 commit f07a45f
Show file tree
Hide file tree
Showing 596 changed files with 1,243 additions and 5,435 deletions.
Binary file modified .vs/Angry_Bird/v15/.suo
Binary file not shown.
Binary file modified .vs/Angry_Bird/v15/Server/sqlite3/storage.ide
Binary file not shown.
Binary file modified .vs/Angry_Bird/v15/Server/sqlite3/storage.ide-shm
Binary file not shown.
Binary file modified .vs/Angry_Bird/v15/Server/sqlite3/storage.ide-wal
Binary file not shown.
201 changes: 13 additions & 188 deletions Assets/Resources/Levels/Map1/Level1OfMap1.prefab

Large diffs are not rendered by default.

291 changes: 18 additions & 273 deletions Assets/Resources/Levels/Map1/Level2OfMap1.prefab

Large diffs are not rendered by default.

19 changes: 15 additions & 4 deletions Assets/Scripts/Bird.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;

public class Bird : MonoBehaviour {
public Vector3 currPos;
Expand Down Expand Up @@ -37,7 +38,10 @@ public enum BirdType {
Red, Yellow, Black, Green
}
public BirdType bt;
public bool isReleased ;

public void Awake() {
isReleased = false;
onGround = true;
sr = GetComponent<SpriteRenderer>();
trail = GetComponent<Trails>().trail;
Expand All @@ -60,7 +64,11 @@ public void Start() {
}

// Update is called once per frame
public void Update() {
void Update() {
//是否点击了UI
if (EventSystem.current.IsPointerOverGameObject()) {
return;
}
currPos = transform.position;
if (isClick) {
transform.position = Camera.main.ScreenToWorldPoint(Input.mousePosition);//将鼠标坐标转化到屏幕空间坐标系
Expand Down Expand Up @@ -123,9 +131,8 @@ public void DirectionalSpeedUpSkill() {
}
//鼠标按下
public void OnMouseDown() {
if (Input.GetMouseButtonDown(0)&&onGround==false) {
if (Input.GetMouseButtonDown(0) && onGround == false) {
AudioPlay(@select);

if (canMove) {
isClick = true;
//接受物理影响
Expand All @@ -135,7 +142,8 @@ public void OnMouseDown() {
}
//鼠标抬起
public void OnMouseUp() {
if (Input.GetMouseButtonUp(0)&&onGround==false) {

if (Input.GetMouseButtonUp(0) && onGround == false) {
launch = true;
if (canMove) {
isClick = false;
Expand All @@ -153,9 +161,12 @@ public void OnMouseUp() {
}
}



}

public void Fly() {
isReleased = true;
AudioPlay(fly);

isFly = true;
Expand Down
4 changes: 1 addition & 3 deletions Assets/Scripts/GameManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ public class GameManager : MonoBehaviour {
public int birdCount;
public int pigCount;
public GameObject[] stars;

public int starCount = 0;//当前关卡星星数量得分
private int totalLevel=6;
void Initialized() {
Expand Down Expand Up @@ -52,7 +51,6 @@ void Start() {

// Update is called once per frame
void Update() {

}

public void NextBird() {
Expand Down Expand Up @@ -117,7 +115,7 @@ public void Pause() {
}

public void Retry() {
SceneManager.LoadScene(0);
SceneManager.LoadScene(2);
Time.timeScale = 1;
}

Expand Down
2 changes: 1 addition & 1 deletion Assets/Scripts/LevelSelect.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public void Select() {
//存储当前关卡的名字编号
PlayerPrefs.SetString("CurrentLevel","Level"+levelNum.GetComponent<Text>().text+ "Of"+currentMap);
//加载具体关卡场景信息
SceneManager.LoadScene(0);
SceneManager.LoadScene(2);
}
}
}
1 change: 1 addition & 0 deletions Assets/Scripts/LoadMapAsync.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ void Awake() {

// Start is called before the first frame update
void Start() {
Screen.SetResolution(1024,768,false);
ie = LoadMapScene(2);
StartCoroutine(ie);
}
Expand Down
2 changes: 2 additions & 0 deletions Assets/Scripts/MapSelect.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ public class MapSelect : MonoBehaviour {
public int mapNum;
// Start is called before the first frame update
void Start() {
//PlayerPrefs.DeleteAll();

string currentMap = PlayerPrefs.GetString("CurrentMap");
//修改通关地图的星数比例
transform.Find("Stars").transform.Find("Rate").GetComponent<Text>().text = PlayerPrefs.GetInt("TotalNumOfStarsIn" + transform.name) + "/ 18";
Expand Down
23 changes: 21 additions & 2 deletions Assets/Scripts/PausePanel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

public class PausePanel : MonoBehaviour {
public Animator anim;
public GameObject pauseButton;
void Awake() {
anim = GetComponent<Animator>();
transform.Find("All").GetComponent<Image>().raycastTarget = false;
transform.Find("All").transform.Find("LeftPopWindow").GetComponent<Image>().raycastTarget = false;
}
// Start is called before the first frame update
void Start() {
Expand All @@ -16,7 +19,7 @@ void Start() {

// Update is called once per frame
void Update() {

}
public void Pause() {
anim.SetBool("isPause", true);
Expand All @@ -25,10 +28,18 @@ public void Pause() {
public void Resume() {
Time.timeScale = 1;
anim.SetBool("isPause", false);
//场景中是否还有鸟
if (GameManager.instance.birds.Count > 0) {
//若弹弓架上的鸟还没有飞(未发射状态)
if (GameManager.instance.birds[0].isReleased == false) {
//不可移动
GameManager.instance.birds[0].canMove = true;
}
}
}

public void Retry() {
SceneManager.LoadScene(0);
SceneManager.LoadScene(2);
Time.timeScale = 1;
}

Expand All @@ -38,6 +49,14 @@ public void PauseAnimStart() {
pauseButton.SetActive(false);
}
public void PauseAnimEnd() {
//场景中是否还有鸟
if (GameManager.instance.birds.Count > 0) {
//若弹弓架上的鸟还没有飞(未发射状态)
if (GameManager.instance.birds[0].isReleased == false) {
//不可移动
GameManager.instance.birds[0].canMove = false;
}
}
Time.timeScale = 0;
}
//resume动画事件
Expand Down
2 changes: 1 addition & 1 deletion Assets/Scripts/Pig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ void Update() {
private void OnCollisionEnter2D(Collision2D collision) {
//collision.relativeVelocity表示相对速度(向量),magnitude表示该向量的模长
//死亡
if (collision.relativeVelocity.magnitude > maxSpeed) {
if (collision.relativeVelocity.magnitude >= maxSpeed) {
Dead();
}
//受伤
Expand Down
64 changes: 32 additions & 32 deletions Library/CurrentLayout-default.dwlt
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,10 @@ MonoBehaviour:
y: 30
width: 1536
height: 731
m_MinSize: {x: 909, y: 372}
m_MaxSize: {x: 22004, y: 14022}
m_MinSize: {x: 917, y: 394}
m_MaxSize: {x: 22012, y: 14044}
vertical: 0
controlID: 129
controlID: 13286
--- !u!114 &6
MonoBehaviour:
m_ObjectHideFlags: 52
Expand All @@ -135,8 +135,8 @@ MonoBehaviour:
y: 0
width: 284
height: 731
m_MinSize: {x: 200, y: 200}
m_MaxSize: {x: 4000, y: 4000}
m_MinSize: {x: 202, y: 222}
m_MaxSize: {x: 4002, y: 4022}
m_ActualView: {fileID: 14}
m_Panes:
- {fileID: 14}
Expand All @@ -163,10 +163,10 @@ MonoBehaviour:
y: 0
width: 908
height: 731
m_MinSize: {x: 434, y: 372}
m_MaxSize: {x: 14004, y: 14022}
m_MinSize: {x: 438, y: 394}
m_MaxSize: {x: 14008, y: 14044}
vertical: 1
controlID: 107
controlID: 13287
--- !u!114 &8
MonoBehaviour:
m_ObjectHideFlags: 52
Expand All @@ -186,8 +186,8 @@ MonoBehaviour:
y: 0
width: 908
height: 381
m_MinSize: {x: 100, y: 100}
m_MaxSize: {x: 4000, y: 4000}
m_MinSize: {x: 104, y: 122}
m_MaxSize: {x: 4004, y: 4022}
m_ActualView: {fileID: 16}
m_Panes:
- {fileID: 15}
Expand Down Expand Up @@ -216,10 +216,10 @@ MonoBehaviour:
y: 381
width: 908
height: 350
m_MinSize: {x: 434, y: 272}
m_MaxSize: {x: 14004, y: 10022}
m_MinSize: {x: 438, y: 272}
m_MaxSize: {x: 14008, y: 10022}
vertical: 0
controlID: 108
controlID: 13288
--- !u!114 &10
MonoBehaviour:
m_ObjectHideFlags: 52
Expand Down Expand Up @@ -265,8 +265,8 @@ MonoBehaviour:
y: 0
width: 568
height: 350
m_MinSize: {x: 200, y: 200}
m_MaxSize: {x: 4000, y: 4000}
m_MinSize: {x: 204, y: 222}
m_MaxSize: {x: 4004, y: 4022}
m_ActualView: {fileID: 13}
m_Panes:
- {fileID: 13}
Expand All @@ -291,8 +291,8 @@ MonoBehaviour:
y: 0
width: 344
height: 731
m_MinSize: {x: 275, y: 50}
m_MaxSize: {x: 4000, y: 4000}
m_MinSize: {x: 277, y: 72}
m_MaxSize: {x: 4002, y: 4022}
m_ActualView: {fileID: 19}
m_Panes:
- {fileID: 19}
Expand Down Expand Up @@ -350,7 +350,7 @@ MonoBehaviour:
m_HSlider: 0
m_VSlider: 0
m_IgnoreScrollWheelUntilClicked: 0
m_EnableMouseInput: 1
m_EnableMouseInput: 0
m_EnableSliderZoomHorizontal: 0
m_EnableSliderZoomVertical: 0
m_UniformScale: 1
Expand Down Expand Up @@ -411,9 +411,9 @@ MonoBehaviour:
m_SceneHierarchy:
m_TreeViewState:
scrollPos: {x: 0, y: 0}
m_SelectedIDs: 3ab60300
m_LastClickedID: 243258
m_ExpandedIDs: fa9cfaffe6acfaffb6b8ffff78fbffff503800002839000072390000e4390000fa3a00004a3b0000303c0000403c00003ab60300
m_SelectedIDs: 6e300000
m_LastClickedID: 0
m_ExpandedIDs: b028feffbe2afeffc62afeffd02afeffe62cfeffea2cfeff343efeff383efeff5a55feff9459feffb474feffb874feff9a7afeff9e7afeff688cfeffc68dfeffca8dfeff22a8feff54a8feff04a9feff24a9feff34a9fefff6f2feff54f4feff58f4feffa463ffffe463ffffd264ffff2a6affffea6affff346bffffb26cfffff2c8ffff30c9ffff2ccaffff6acaffffecf9fffff6f9ffff44faffff78fbffff84460000a4460000029b0000eeaa00002eae0000b8be0000aeed0100d6ed0100
m_RenameOverlay:
m_UserAcceptedRename: 0
m_Name:
Expand Down Expand Up @@ -605,9 +605,9 @@ MonoBehaviour:
m_PlayAudio: 0
m_AudioPlay: 0
m_Position:
m_Target: {x: 323.82825, y: 205.94766, z: 15330.362}
m_Target: {x: -0.8051197, y: -13683.862, z: -1.2012545}
speed: 2
m_Value: {x: 323.82825, y: 205.94766, z: 15330.362}
m_Value: {x: -0.8051197, y: -13683.862, z: -1.2012545}
m_RenderMode: 0
m_CameraMode:
drawMode: 0
Expand Down Expand Up @@ -640,9 +640,9 @@ MonoBehaviour:
speed: 2
m_Value: {x: 0, y: 0, z: 0, w: 1}
m_Size:
m_Target: 543.54224
m_Target: 10.533686
speed: 2
m_Value: 543.54224
m_Value: 10.533686
m_Ortho:
m_Target: 1
speed: 2
Expand Down Expand Up @@ -746,7 +746,7 @@ MonoBehaviour:
scrollPos: {x: 0, y: 0}
m_SelectedIDs: 74300000
m_LastClickedID: 12404
m_ExpandedIDs: 000000001c2d00004a2d0000e02d00003e2e0000422e0000922e0000662f0000ee2f0000f82f000074300000b2300000da300000f4300000083100002a310000ba310000c0310000d8310000c432000004330000103300002e330000b83300007e350000f03c0000
m_ExpandedIDs: ffffffff00000000362d0000662d0000fc2d0000962e0000d42e0000e82e00004c30000056300000d4300000dc300000123100003a31000054310000683100001c320000223200003a3200009a3200002a3300006c3300007833000022340000983e0000
m_RenameOverlay:
m_UserAcceptedRename: 0
m_Name:
Expand All @@ -771,24 +771,24 @@ MonoBehaviour:
m_Icon: {fileID: 0}
m_ResourceFile:
m_AssetTreeState:
scrollPos: {x: 0, y: 514}
scrollPos: {x: 0, y: 496.6}
m_SelectedIDs:
m_LastClickedID: 0
m_ExpandedIDs: ffffffff000000001c2d00004a2d0000e02d0000422e0000922e0000ee2f0000f82f0000743000007c300000b2300000da300000f430000008310000ba310000c0310000d8310000c43200000433000010330000b8330000f03c000090520000d8510100
m_ExpandedIDs: ffffffff00000000362d0000662d0000fc2d0000962e0000d42e0000e82e00004c30000056300000d4300000dc300000123100003a31000054310000683100001c320000223200003a3200009a3200002a3300006c33000022340000983e0000
m_RenameOverlay:
m_UserAcceptedRename: 0
m_Name:
m_OriginalName:
m_Name: Black_Bird
m_OriginalName: Black_Bird
m_EditFieldRect:
serializedVersion: 2
x: 0
y: 0
width: 0
height: 0
m_UserData: 0
m_UserData: 12532
m_IsWaitingForDelay: 0
m_IsRenaming: 0
m_OriginalEventType: 11
m_OriginalEventType: 0
m_IsRenamingFilename: 1
m_ClientGUIView: {fileID: 10}
m_SearchString:
Expand Down
Loading

0 comments on commit f07a45f

Please sign in to comment.