Init
This commit is contained in:
22
Assets/ThirdParty/DestroyIt/Demos (safe to delete)/Scripts/Behaviors/RocketLoading.cs
vendored
Normal file
22
Assets/ThirdParty/DestroyIt/Demos (safe to delete)/Scripts/Behaviors/RocketLoading.cs
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace DestroyIt
|
||||
{
|
||||
public class RocketLoading : MonoBehaviour
|
||||
{
|
||||
public bool isLoaded = true; // start off with the rocket loaded into the launcher
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
if (isLoaded) // if the rocket is already loaded, position the game object so it is in the launcher.
|
||||
transform.localPosition = new Vector3(transform.localPosition.x, transform.localPosition.y, 0.74f);
|
||||
else // if rocket is not currently loaded, play the rocket loading animation
|
||||
{
|
||||
Animation anim = gameObject.GetComponent<Animation>();
|
||||
if (anim != null)
|
||||
anim.Play("Rocket Loading");
|
||||
isLoaded = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user