ShanDongVirtualPowerPlant/u3d-ShanDongVirtualPowerPlant/Assets/Adam/Scripts/Bootstrap.cs

30 lines
1.1 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Bootstrap : MonoSingleton<Bootstrap>
{
public LandMarksAndInfoController landMarkAndInfoCotroller;
public List<string> landMarks;
// Start is called before the first frame update
void Start()
{
landMarks = new List<string> { "网络负荷49.84 kw", "上网负荷49.84 kw", "削峰负荷49.84 kw", "填谷负荷49.84 kw", "发电负荷49.84 kw" };
landMarkAndInfoCotroller.gameObject.SetActive(false);
}
public void ShowLandMark(GameObject land)
{
landMarkAndInfoCotroller.gameObject.SetActive(true);
Vector3 worldToScreenPoint = Camera.main.WorldToScreenPoint(new Vector3(land.transform.position.x, land.transform.position.y, land.transform.position.z));
landMarkAndInfoCotroller.GetComponent<RectTransform>().position = new Vector3(worldToScreenPoint.x, worldToScreenPoint.y, 0);
landMarkAndInfoCotroller.SetMarksInfo(land.name, landMarks);
}
public void CloseLandMark()
{
landMarkAndInfoCotroller.gameObject.SetActive(false);
}
}