Compare commits

..

No commits in common. '43a50d5374df361cf9356bc43c3d53dbd3b5b1fb' and '13d5237c6b2db8619777ea2eceb1e299788067f7' have entirely different histories.

  1. 19
      Assets/Prefabs/Modifications/WidthBuff.asset
  2. 8
      Assets/Prefabs/Modifications/WidthBuff.asset.meta
  3. 19
      Assets/Prefabs/Modifications/WidthNerf.asset
  4. 8
      Assets/Prefabs/Modifications/WidthNerf.asset.meta
  5. 4
      Assets/Scenes/Game.unity
  6. 7
      Assets/Scripts/Game/GameManager.cs
  7. 63
      Assets/Scripts/Game/Wormhole.cs

@ -1,19 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4453d1448ec14f5fa81aae3c54f78010, type: 3}
m_Name: WidthBuff
m_EditorClassIdentifier:
type: 1
effect: 2
pickupDuration: 10
activeDuration: 10
image: {fileID: 21300000, guid: f09eae8c0ea04254b90c5386a034a225, type: 3}

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 3237b9257f669690ea1a6f828451509e
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

@ -1,19 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4453d1448ec14f5fa81aae3c54f78010, type: 3}
m_Name: WidthNerf
m_EditorClassIdentifier:
type: 0
effect: 2
pickupDuration: 10
activeDuration: 10
image: {fileID: 21300000, guid: f9161c6c9e06dc445ada3ee16d991f90, type: 3}

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: c6de04aab82eeff81894387c19ac1310
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

@ -1025,9 +1025,7 @@ MonoBehaviour:
- {fileID: 11400000, guid: ae5a83823d492d27bbb84006f6e0e8c2, type: 2} - {fileID: 11400000, guid: ae5a83823d492d27bbb84006f6e0e8c2, type: 2}
- {fileID: 11400000, guid: df0f24b538b5fed02a7faa3a5e0f121b, type: 2} - {fileID: 11400000, guid: df0f24b538b5fed02a7faa3a5e0f121b, type: 2}
- {fileID: 11400000, guid: 73dc3bbc93cba37b1b989a9497b680e7, type: 2} - {fileID: 11400000, guid: 73dc3bbc93cba37b1b989a9497b680e7, type: 2}
- {fileID: 11400000, guid: 3237b9257f669690ea1a6f828451509e, type: 2} wormholePrefab: {fileID: 0}
- {fileID: 11400000, guid: c6de04aab82eeff81894387c19ac1310, type: 2}
wormholePrefab: {fileID: 7486271855853268360, guid: bf48a6813e1f5a2f7a63fc5c413808cb, type: 3}
--- !u!4 &2109945868 --- !u!4 &2109945868
Transform: Transform:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

@ -41,8 +41,6 @@ namespace Game {
while (Application.isPlaying) { while (Application.isPlaying) {
yield return new WaitForSeconds(1); yield return new WaitForSeconds(1);
SpawnModification(); SpawnModification();
yield return new WaitForSeconds(2);
SpawnWormhole();
} }
} }
@ -89,10 +87,7 @@ namespace Game {
Player2 = p2; Player2 = p2;
} }
private void SpawnWormhole() { private void SpawnWormhole() { }
var pos = new Vector2(Random.Range(0, Dimensions.Singleton.PlaySize.x) - Dimensions.Singleton.PlaySize.x / 2, Random.Range(-5, 5));
Instantiate(wormholePrefab, pos, Quaternion.identity);
}
private void SpawnModification() { private void SpawnModification() {
var pos = new Vector2(Random.Range(0, Dimensions.Singleton.PlaySize.x) - Dimensions.Singleton.PlaySize.x / 2, Random.Range(-2, 2)); var pos = new Vector2(Random.Range(0, Dimensions.Singleton.PlaySize.x) - Dimensions.Singleton.PlaySize.x / 2, Random.Range(-2, 2));

@ -1,72 +1,17 @@
using System.Collections;
using System.Linq;
using Unity.Netcode; using Unity.Netcode;
using UnityEngine; using UnityEngine;
namespace Game { namespace Game {
public class Wormhole : NetworkBehaviour { public class Wormhole : NetworkBehaviour {
public float duration = 10; public float Size { get; set; }
private const float MaxSize = 10; private void Start() {
transform.localScale = new Vector3(Size, Size, Size);
private float size;
public float Size {
get => size;
set {
size = value;
transform.localScale = new Vector3(size, size, 1);
}
}
private float Radius => Size / 2;
private static float CubicEaseInOut(float t, float b, float c, float d) {
if ((t /= d / 2) < 1) return c / 2 * t * t * t + b;
return c / 2 * ((t -= 2) * t * t + 2) + b;
}
private static float CircleEaseInOut(float t, float b, float c, float d) {
if ((t /= d / 2) < 1) return -c / 2 * (Mathf.Sqrt(1 - t * t) - 1) + b;
return c / 2 * (Mathf.Sqrt(1 - (t -= 2) * t) + 1) + b;
}
private IEnumerator Grow(float growTime) {
float currentTime = 0;
while (currentTime <= growTime) {
Size = CircleEaseInOut(currentTime, 0, MaxSize, growTime);
yield return new WaitForFixedUpdate();
currentTime += Time.fixedDeltaTime;
}
}
private IEnumerator Shrink(float shrinkTime) {
float currentTime = 0;
while (currentTime <= shrinkTime) {
Size = CubicEaseInOut(currentTime, MaxSize, -MaxSize, shrinkTime);
yield return new WaitForFixedUpdate();
currentTime += Time.fixedDeltaTime;
}
}
private IEnumerator Start() {
Size = 0;
yield return Grow(duration * 0.2f);
yield return new WaitForSeconds(duration * 0.7f);
yield return Shrink(duration * 0.1f);
} }
private void FixedUpdate() { private void FixedUpdate() {
Vector2 thisPos = new Vector2(transform.position.x, transform.position.y); foreach (var ball in GameManager.Singleton.Balls) { }
foreach (var ball in GameManager.Singleton.Balls) {
Vector2 diff = thisPos - ball.Rb.position;
if (diff.sqrMagnitude > Radius * Radius)
continue;
float dist = diff.magnitude;
Vector2 force = diff.normalized / dist * (Size * 5);
force = Vector2.ClampMagnitude(force, 15);
ball.Rb.AddForce(force);
}
} }
} }
} }

Loading…
Cancel
Save