Fix golden / anti berry (it's different to how it was in 26.1>)
This commit is contained in:
3 files changed
+39
-15
No files matched your search
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
using TMPro;
|
||||
@@ -217,13 +218,20 @@ public class AutoGamePlayer : MonoBehaviour {
|
||||
TogglePause();
|
||||
}
|
||||
if (antiLeft > 0f || goldenLeft > 0f) {
|
||||
string[] berryTags = { "NormalBerry", "SlowBerry", "UltraBerry", "SpeedyBerry", "RandomBerry", "AntiBerry", "GoldenBerry" };
|
||||
if (antiLeft > 0f) berryTags.Append("PoisonBerry");
|
||||
List<string> berryTags = new() { "NormalBerry", "SlowBerry", "UltraBerry", "SpeedyBerry", "CoinBerry", "RandomBerry", "AntiBerry", "GoldenBerry" };
|
||||
if (antiLeft > 0f) berryTags.Add("PoisonBerry");
|
||||
|
||||
float scale = (canvasRect.lossyScale.x + canvasRect.lossyScale.y) / 2f;
|
||||
float radius = antiLeft > 0f ? 250f * scale : 300f * scale;
|
||||
float speed = antiLeft > 0f ? 2.5f * scale : -1f * scale;
|
||||
|
||||
foreach (string tag in berryTags) {
|
||||
foreach (var berry in GameObject.FindGameObjectsWithTag(tag)) {
|
||||
UnityEngine.Vector3 dir = berry.transform.position - bird.transform.position;
|
||||
if (dir.magnitude < (antiLeft > 0 ? 3f : 4.5f)) {
|
||||
berry.GetComponent<Rigidbody2D>().linearVelocity = dir.normalized * (antiLeft > 0 ? 5f : -5f);
|
||||
RectTransform berryRect = berry.GetComponent<RectTransform>();
|
||||
UnityEngine.Vector3 dir = berryRect.position - bird.GetComponent<RectTransform>().position;
|
||||
|
||||
if (dir.magnitude < radius) {
|
||||
berryRect.position += speed * dir.normalized;
|
||||
ClampPosition(berry.GetComponent<Image>());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
using TMPro;
|
||||
@@ -174,13 +175,20 @@ public class CustomGamePlayer : MonoBehaviour {
|
||||
if (score != 0) Respawn();
|
||||
}
|
||||
if (antiLeft > 0f || goldenLeft > 0f) {
|
||||
string[] berryTags = { "NormalBerry", "SlowBerry", "UltraBerry", "SpeedyBerry", "RandomBerry", "AntiBerry", "GoldenBerry", "NothingBerry" };
|
||||
if (antiLeft > 0f) berryTags.Append("PoisonBerry");
|
||||
List<string> berryTags = new() { "NormalBerry", "SlowBerry", "UltraBerry", "SpeedyBerry", "CoinBerry", "RandomBerry", "AntiBerry", "GoldenBerry" };
|
||||
if (antiLeft > 0f) berryTags.Add("PoisonBerry");
|
||||
|
||||
float scale = (canvasRect.lossyScale.x + canvasRect.lossyScale.y) / 2f;
|
||||
float radius = antiLeft > 0f ? 250f * scale : 300f * scale;
|
||||
float speed = antiLeft > 0f ? 2.5f * scale : -1f * scale;
|
||||
|
||||
foreach (string tag in berryTags) {
|
||||
foreach (var berry in GameObject.FindGameObjectsWithTag(tag)) {
|
||||
UnityEngine.Vector3 dir = berry.transform.position - bird.transform.position;
|
||||
if (dir.magnitude < (antiLeft > 0 ? 3f : 4.5f)) {
|
||||
berry.GetComponent<Rigidbody2D>().linearVelocity = dir.normalized * (antiLeft > 0 ? 5f : -5f);
|
||||
RectTransform berryRect = berry.GetComponent<RectTransform>();
|
||||
UnityEngine.Vector3 dir = berryRect.position - bird.GetComponent<RectTransform>().position;
|
||||
|
||||
if (dir.magnitude < radius) {
|
||||
berryRect.position += speed * dir.normalized;
|
||||
ClampPosition(berry.GetComponent<Image>());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
using TMPro;
|
||||
@@ -160,13 +161,20 @@ public class GamePlayer : MonoBehaviour {
|
||||
if (score != 0) Respawn();
|
||||
}
|
||||
if (antiLeft > 0f || goldenLeft > 0f) {
|
||||
string[] berryTags = { "NormalBerry", "SlowBerry", "UltraBerry", "SpeedyBerry", "CoinBerry", "RandomBerry", "AntiBerry", "GoldenBerry" };
|
||||
if (antiLeft > 0f) berryTags.Append("PoisonBerry");
|
||||
List<string> berryTags = new() { "NormalBerry", "SlowBerry", "UltraBerry", "SpeedyBerry", "CoinBerry", "RandomBerry", "AntiBerry", "GoldenBerry" };
|
||||
if (antiLeft > 0f) berryTags.Add("PoisonBerry");
|
||||
|
||||
float scale = (canvasRect.lossyScale.x + canvasRect.lossyScale.y) / 2f;
|
||||
float radius = antiLeft > 0f ? 250f * scale : 300f * scale;
|
||||
float speed = antiLeft > 0f ? 2.5f * scale : -1f * scale;
|
||||
|
||||
foreach (string tag in berryTags) {
|
||||
foreach (var berry in GameObject.FindGameObjectsWithTag(tag)) {
|
||||
UnityEngine.Vector3 dir = berry.transform.position - bird.transform.position;
|
||||
if (dir.magnitude < (antiLeft > 0 ? 3f : 4.5f)) {
|
||||
berry.GetComponent<Rigidbody2D>().linearVelocity = dir.normalized * (antiLeft > 0 ? 5f : -5f);
|
||||
RectTransform berryRect = berry.GetComponent<RectTransform>();
|
||||
UnityEngine.Vector3 dir = berryRect.position - bird.GetComponent<RectTransform>().position;
|
||||
|
||||
if (dir.magnitude < radius) {
|
||||
berryRect.position += speed * dir.normalized;
|
||||
ClampPosition(berry.GetComponent<Image>());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user