new-horizons/NewHorizons/Components/RotateToCustomAstroObject.cs
2021-12-16 17:37:00 -05:00

50 lines
1.1 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;
namespace NewHorizons.Components
{
public class RotateToCustomAstroObject : RotateToPoint
{
private void FixedUpdate()
{
if (this._quaternionTargetMode)
{
this._hasTargetLock = base.CheckLockedOn();
this.IncrementalRotate(Time.fixedDeltaTime);
return;
}
if (this._astroObjectLock == AstroObject.Name.None)
{
this._hasTargetLock = false;
return;
}
AstroObject astroObject = Locator.GetAstroObject(this._astroObjectLock);
if (astroObject == null)
{
this._hasTargetLock = false;
return;
}
this._target = astroObject.transform.position;
this._hasTargetLock = base.CheckLockedOn();
this.IncrementalRotate(Time.fixedDeltaTime);
}
public void SetNewAstroTarget(AstroObject.Name name, string customName, bool resetRampUp)
{
if (resetRampUp)
{
base.ResetRotationSpeed(resetRampUp);
}
_astroObjectLock = name;
_astroObjectCustomName = customName;
}
private AstroObject.Name _astroObjectLock;
private string _astroObjectCustomName;
}
}