quantum-space-buddies/QSB/QuantumSync/WorldObjects/QSBQuantumShuffleObject.cs

25 lines
686 B
C#
Raw Normal View History

2021-01-26 14:07:17 +00:00
using OWML.Utils;
using UnityEngine;
2021-01-01 10:17:35 +00:00
namespace QSB.QuantumSync.WorldObjects
{
2021-01-26 17:08:02 +00:00
internal class QSBQuantumShuffleObject : QSBQuantumObject<QuantumShuffleObject>
2021-01-01 10:17:35 +00:00
{
public override void Init(QuantumShuffleObject shuffleObject, int id)
{
ObjectId = id;
AttachedObject = shuffleObject;
2021-01-26 17:08:02 +00:00
base.Init(shuffleObject, id);
2021-01-26 14:07:17 +00:00
}
public void ShuffleObjects(int[] indexArray)
{
var shuffledObjects = AttachedObject.GetValue<Transform[]>("_shuffledObjects");
var localPositions = AttachedObject.GetValue<Vector3[]>("_localPositions");
for (var i = 0; i < shuffledObjects.Length; i++)
{
shuffledObjects[i].localPosition = localPositions[indexArray[i]];
}
2021-01-01 10:17:35 +00:00
}
}
2021-01-26 14:07:17 +00:00
}