diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..4edd970 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,56 @@ +{ + "files.exclude": + { + "**/.DS_Store":true, + "**/.git":true, + "**/.gitignore":true, + "**/.gitmodules":true, + "**/*.booproj":true, + "**/*.pidb":true, + "**/*.suo":true, + "**/*.user":true, + "**/*.userprefs":true, + "**/*.unityproj":true, + "**/*.dll":true, + "**/*.exe":true, + "**/*.pdf":true, + "**/*.mid":true, + "**/*.midi":true, + "**/*.wav":true, + "**/*.gif":true, + "**/*.ico":true, + "**/*.jpg":true, + "**/*.jpeg":true, + "**/*.png":true, + "**/*.psd":true, + "**/*.tga":true, + "**/*.tif":true, + "**/*.tiff":true, + "**/*.3ds":true, + "**/*.3DS":true, + "**/*.fbx":true, + "**/*.FBX":true, + "**/*.lxo":true, + "**/*.LXO":true, + "**/*.ma":true, + "**/*.MA":true, + "**/*.obj":true, + "**/*.OBJ":true, + "**/*.asset":true, + "**/*.cubemap":true, + "**/*.flare":true, + "**/*.mat":true, + "**/*.meta":true, + "**/*.prefab":true, + "**/*.unity":true, + "build/":true, + "Build/":true, + "Library/":true, + "library/":true, + "obj/":true, + "Obj/":true, + "ProjectSettings/":true, + "temp/":true, + "Temp/":true + } +} \ No newline at end of file diff --git a/Assets/Scripts/Bird.cs b/Assets/Scripts/Bird.cs index ab7b124..a3cab52 100644 --- a/Assets/Scripts/Bird.cs +++ b/Assets/Scripts/Bird.cs @@ -9,14 +9,11 @@ public enum BirdState { Idle, Thrown, HitSomething } public GameObject Parent; public Rigidbody2D birdRigidbody; public CircleCollider2D birdCollider; - private BirdState state; private float minVelocity = 0.05f; private bool flagDestroy = false; - public UnityAction OnBirdDestroyed = delegate { }; public UnityAction OnBirdShot = delegate { }; - public BirdState State { get => state; private set => state = value; } private void Start() @@ -46,12 +43,6 @@ private IEnumerator DestroyAfter(float timeInSecond) Destroy(gameObject); } - public void MoveTo(Vector2 target, GameObject parent) - { - gameObject.transform.SetParent(parent.transform); - gameObject.transform.position = target; - } - public void Shoot(Vector2 velocity, float distance, float speed) { birdCollider.enabled = true; @@ -60,9 +51,10 @@ public void Shoot(Vector2 velocity, float distance, float speed) OnBirdShot(this); } - public virtual void OnTap() + public void MoveTo(Vector2 target, GameObject parent) { - + gameObject.transform.SetParent(parent.transform); + gameObject.transform.position = target; } private void OnDestroy() diff --git a/Assets/Scripts/Destroyer.cs b/Assets/Scripts/Destroyer.cs index 7583329..9536811 100644 --- a/Assets/Scripts/Destroyer.cs +++ b/Assets/Scripts/Destroyer.cs @@ -4,6 +4,7 @@ public class Destroyer : MonoBehaviour { + private void OnTriggerEnter2D(Collider2D collision) { string collisionTag = collision.gameObject.tag; @@ -12,4 +13,5 @@ private void OnTriggerEnter2D(Collider2D collision) Destroy(collision.gameObject); } } + s } diff --git a/Assets/Scripts/GameController.cs b/Assets/Scripts/GameController.cs index ed5ac8f..024d422 100644 --- a/Assets/Scripts/GameController.cs +++ b/Assets/Scripts/GameController.cs @@ -31,7 +31,14 @@ private void Start() shotBird = birds[0]; } - public void ChangeBird() + public void AssignTrail(Bird selectedBird) + { + trailController.SetBird(selectedBird); + StartCoroutine(trailController.SpawnTrails()); + tapCollider.enabled = true; + } + + public void ChangeBird() { tapCollider.enabled = false; @@ -46,13 +53,6 @@ public void ChangeBird() } } - public void AssignTrail(Bird selectedBird) - { - trailController.SetBird(selectedBird); - StartCoroutine(trailController.SpawnTrails()); - tapCollider.enabled = true; - } - public void CheckGameEnd(GameObject destroyedEnemy) { for (int i = 0; i < enemies.Count; i++) diff --git a/Assets/Scripts/SlingShooter.cs b/Assets/Scripts/SlingShooter.cs index b158402..19015c7 100644 --- a/Assets/Scripts/SlingShooter.cs +++ b/Assets/Scripts/SlingShooter.cs @@ -4,11 +4,13 @@ using UnityEngine; public class SlingShooter : MonoBehaviour + { - public CircleCollider2D collider; - private Vector2 startPos; [SerializeField] private float radius = 0.75f; [SerializeField] private float throwSpeed = 30f; + + public CircleCollider2D collider; + private Vector2 startPos; private Bird birdInSling; public LineRenderer trajectoryRenderer; diff --git a/Assets/Scripts/TrailController.cs b/Assets/Scripts/TrailController.cs index 29cd40e..97046b7 100644 --- a/Assets/Scripts/TrailController.cs +++ b/Assets/Scripts/TrailController.cs @@ -7,8 +7,8 @@ public class TrailController : MonoBehaviour public GameObject Trail; public Bird targetBird; private List trails; - private void Start() + { trails = new List(); }