You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

104 lines
2.2 KiB

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()
{
}
/// <summary>
/// 选择商店渲染
/// </summary>
/// <param name="spareId"></param>
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);
}
}
/// <summary>
/// 选择渲染零件
/// </summary>
/// <param name="name"></param>
public void SelectRSpare()
{
if (curSpareGo != null)
{
curSpareGo.SetActive(true);
}
if (curUISpareGo != null)
{
IntroduceAnimation animation = curUISpareGo.GetComponent<IntroduceAnimation>();
if (animation != null)
{
animation.ShowAll();
}
}
}
/// <summary>
/// 隐藏渲染零件
/// </summary>
public void HideRSpare()
{
if (curSpareGo != null)
{
if(rotation_tw!=null)
{
rotation_tw.Kill();
}
curSpareGo.SetActive(false);
}
if (curUISpareGo != null)
{
IntroduceAnimation animation = curUISpareGo.GetComponent<IntroduceAnimation>();
if (animation != null)
{
animation.HideAll();
}
}
}
}
}