コード例 #1
0
 void Awake()
 {
     if (instance != null)
     {
         Debug.LogError("More than one EnemyInfoPanel in scene !"); return;
     }
     instance = this;
 }
コード例 #2
0
ファイル: EnemyViewer.cs プロジェクト: facybenbook/Cosmica
    private IEnumerator SpawnInfoPanel()
    {
        if (infoPanelPrefab != null)
        {
            yield return(new WaitForSeconds(infoSpawnDelay));

            EnemyInfoPanel infoPanel = Instantiate(infoPanelPrefab, transform.position, Quaternion.identity) as EnemyInfoPanel;
            infoPanel.transform.SetParent(infoPanelCanvas.transform, false);
            infoPanel.transform.position = transform.position + infoPanelOffset;
            infoPanel.SetCurrentUnit(enemy);
        }
    }
コード例 #3
0
ファイル: EnemyInfoPanel.cs プロジェクト: haydon19/OTiS
 public void Start()
 {
     if (instance == null)
     {
         //...set this one to be it...
         instance = this;
     }
     //...otherwise...
     else if (instance != this)
     {
         //...destroy this one because it is a duplicate.
         Destroy(gameObject);
     }
 }