fixed stupid wraparound issue

This commit is contained in:
Dom Harris 2021-01-10 17:34:30 +00:00
parent 99e949cd9b
commit 60f39951a5
6 changed files with 52 additions and 4 deletions

View File

@ -15,6 +15,7 @@ GameObject:
- component: {fileID: 2766037370157449026}
- component: {fileID: 2122656558574222561}
- component: {fileID: -3971665732303992234}
- component: {fileID: -4901459127090716512}
m_Layer: 7
m_Name: Enemy
m_TagString: Untagged
@ -136,3 +137,17 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
value: 1000
--- !u!114 &-4901459127090716512
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1738226812227614583}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 990644fedd5c4b99befe1da660313b53, type: 3}
m_Name:
m_EditorClassIdentifier:
xMin: -10.1
xMax: 10.1

View File

@ -275,8 +275,8 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
spawnOnBeat: 1
xMin: -5
xMax: 5
xMin: -10
xMax: 10
--- !u!114 &531937975 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 5076175860835241000, guid: 1f82f952c53fc7449a0091cf29ba3def, type: 3}

View File

@ -1,7 +1,9 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Weapons.Scripts;
using Random = UnityEngine.Random;
public class AddScoreOnDie : MonoBehaviour
{

View File

@ -0,0 +1,28 @@
using UnityEngine;
public class WrapAroundOnEnable : MonoBehaviour
{
[SerializeField] private float xMin, xMax;
private void OnEnable()
{
WaitUtils.Wait(Time.deltaTime, true, () =>
{
var w = Mathf.Abs(xMax - xMin);
var x = transform.localPosition.x;
if (x > xMax)
{
x -= w;
}
else if (x < xMin)
{
x += w;
}
transform.localPosition = new Vector3(
x,
transform.localPosition.y,
transform.localPosition.z);
});
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 990644fedd5c4b99befe1da660313b53
timeCreated: 1610299723

View File

@ -113,12 +113,12 @@ MonoBehaviour:
spawnPlane: 1
width: 0
height: 0
surfaceOnly: 1
surfaceOnly: 0
evenDistribution: 0
numSides: 3
numPerSide: 10
flipVertical: 0
radius: 5
radius: 10
arc: 360
composite: []
manualFire: 1