43 lines
1000 B
C#
43 lines
1000 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class PickupItem : PoolableMonoBehaviour
|
|
{
|
|
public float Fuel
|
|
{
|
|
get
|
|
{
|
|
if(PickedUp)
|
|
return 0.0f;
|
|
|
|
return 0.25f;
|
|
}
|
|
}
|
|
|
|
public GameObject WavingPreviewItem;
|
|
|
|
public bool PickedUp = false;
|
|
|
|
public override void OnReturn()
|
|
{
|
|
PickedUp = false;
|
|
WavingPreviewItem.SetActive(true);
|
|
|
|
base.OnReturn();
|
|
}
|
|
|
|
public void OnPickup()
|
|
{
|
|
PickedUp = true;
|
|
WavingPreviewItem.SetActive(false);
|
|
AudioManager.Instance.GetAudioSource(AudioClip.ItemPickupEffect).Play();
|
|
}
|
|
|
|
protected void Update()
|
|
{
|
|
WavingPreviewItem.transform.localPosition = new Vector3(0.0f, Mathf.Sin(Time.time * 3.0f) * 0.15f, 0.0f);
|
|
WavingPreviewItem.transform.localRotation = Quaternion.AngleAxis(100.0f * Time.deltaTime, Vector3.up) * WavingPreviewItem.transform.localRotation;
|
|
}
|
|
}
|