91 lines
2.8 KiB
C#
91 lines
2.8 KiB
C#
using Sirenix.OdinInspector;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
|
|
#if UNITY_EDITOR
|
|
using UnityEditor;
|
|
#endif
|
|
using UnityEngine;
|
|
|
|
namespace ZMS.Configura
|
|
{
|
|
public class ConstructConf : SiteConfigura
|
|
{
|
|
public Transform mainStructure;//???
|
|
public Transform structureUp;//???
|
|
public Transform protection;//??????
|
|
public Transform discharge;//§Ø????
|
|
|
|
public Material material_SelectBOB;
|
|
public Material material_NotSelectBOB;
|
|
public MeshRenderer meshRenderer;
|
|
|
|
public float siteHig;
|
|
public float siteUPHig;
|
|
|
|
Coroutine SiteCoroutine;
|
|
public override void SetPostionSite()
|
|
{
|
|
//print("?????");
|
|
//mainStructure.localScale = new Vector3(dimension_Trf.localScale.x, dimension_Trf.localScale.y, heigthSite);
|
|
//protection.localScale = new Vector3(dimension_Trf.localScale.x, dimension_Trf.localScale.y, heigthSite);
|
|
|
|
}
|
|
|
|
#if UNITY_EDITOR
|
|
[MenuItem("set")]
|
|
#endif
|
|
public void setsit()
|
|
{
|
|
SetSite(siteHig,siteUPHig);
|
|
}
|
|
|
|
[Button()]
|
|
public void SetSite(float strucHight, float strucUpHight)
|
|
{
|
|
if (SiteCoroutine != null)
|
|
{
|
|
StopCoroutine(SiteCoroutine);
|
|
}
|
|
StartCoroutine(SetSite_IEtor(strucHight,strucUpHight));
|
|
}
|
|
|
|
IEnumerator SetSite_IEtor(float strucHight,float strucUpHight)
|
|
{
|
|
while (strucHight-mainStructure.localScale.z >0.8f)
|
|
{
|
|
yield return new WaitForFixedUpdate();
|
|
mainStructure.localScale = Vector3.Lerp(mainStructure.localScale,
|
|
new Vector3(mainStructure.localScale.x,mainStructure.localScale.y,strucHight), Time.fixedDeltaTime);
|
|
|
|
protection.localPosition = structureUp.localPosition = new Vector3(structureUp.localPosition.x,
|
|
structureUp.localPosition.y, mainStructure.localScale.z - 1);
|
|
|
|
}
|
|
//mainStructure.localScale = new Vector3(mainStructure.localScale.x,
|
|
// mainStructure.localScale.y, strucHight);
|
|
|
|
|
|
while (strucHight + mainStructure.localScale.z > 0.8f)
|
|
{
|
|
yield return new WaitForFixedUpdate();
|
|
protection.localScale = Vector3.Lerp(protection.localScale,
|
|
new Vector3(protection.localScale.x, protection.localScale.y, -strucUpHight), Time.fixedDeltaTime);
|
|
}
|
|
}
|
|
|
|
public void Setmet(bool a)
|
|
{
|
|
if (a)
|
|
{
|
|
meshRenderer.materials[0].CopyPropertiesFromMaterial(material_SelectBOB);
|
|
}
|
|
else
|
|
{
|
|
meshRenderer.materials[0].CopyPropertiesFromMaterial(material_NotSelectBOB);
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|