Пример #1
0
    private void SetStageInfo()
    {
        var manager = GameManager.Instance;

        string    nextStage     = "Stage" + nowSelected.ToString();
        StageInfo nextStageInfo = stageInfo[nextStage];

        stagePanel.SetDisplayFromStageInfo(nextStageInfo);

        isLocked = nextStageInfo.unlockCoin > manager.GetCollectedCoinNum();

        if (isLocked)
        {
            if (!locked)
            {
                var obj = Instantiate(Resources.Load("Prefabs/Locked") as GameObject, stagePanel.gameObject.GetComponent <Transform>());
                locked = obj.GetComponent <Locked>();
            }

            locked.SetUnlockInfoText(nextStageInfo.unlockCoin);
        }
        else
        {
            if (locked)
            {
                locked.GetComponent <Animator>().SetTrigger("Destroy");
                locked = null;
            }
        }
    }
Пример #2
0
 public void EffectPosition()
 {
     if (Locked != null)
     {
         Bounds  closet   = Locked.GetComponent <Collider>().bounds;
         Vector3 Point    = closet.max;
         float   distance = Vector3.Distance(Locked.transform.position, Point);
         Vector3 Ofset    = Locked.transform.position + new Vector3(0, 0, -distance + 3);
         Icon.transform.position = Ofset;
         Icon.SetActive(true);
     }
     else
     {
         Icon.SetActive(false);
     }
 }