using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System;
using DG.Tweening;
namespace DisComputer
{
/*
* @func 渲染零件控制
* @author lz
* @date 2020/07/01
*/
public class RendererSpare : MonoBehaviour
{
public GameObject curSpareGo;
public GameObject curUISpareGo;
//旋转
private Tween rotation_tw;
// Start is called before the first frame update
void Start()
{
}
///
/// 选择商店渲染
///
///
public void SelectStoreRSpare()
{
if (curSpareGo != null)
{
curSpareGo.SetActive(true);
rotation_tw = curSpareGo.transform.DOLocalRotate(new Vector3(0, -360, 0), 5.0f, RotateMode.FastBeyond360);
rotation_tw.SetLoops(-1);
rotation_tw.SetEase(Ease.Linear);
}
}
///
/// 选择渲染零件
///
///
public void SelectRSpare()
{
if (curSpareGo != null)
{
curSpareGo.SetActive(true);
}
if (curUISpareGo != null)
{
IntroduceAnimation animation = curUISpareGo.GetComponent();
if (animation != null)
{
animation.ShowAll();
}
}
}
///
/// 隐藏渲染零件
///
public void HideRSpare()
{
if (curSpareGo != null)
{
if(rotation_tw!=null)
{
rotation_tw.Kill();
}
curSpareGo.SetActive(false);
}
if (curUISpareGo != null)
{
IntroduceAnimation animation = curUISpareGo.GetComponent();
if (animation != null)
{
animation.HideAll();
}
}
}
}
}