Esempio n. 1
0
 public void Awake()
 {
     if (instance == null)
     {
         instance = this;
         DontDestroyOnLoad(gameObject);
     }
     else
     {
         Destroy(gameObject);
         return;
     }
 }
Esempio n. 2
0
    public void Initialize(Card card, CardViewManager manager)
    {
        CardViewManagerRef = manager;
        LinkedCard         = card;
        LinkedCardInfo     = card.Info;
        CardGraphicsRef    = graphicsRootRef;

        //instantiate the ui components
        background   = Instantiate(LinkedCardInfo.cardBackgroundPref, graphicsRootRef).GetComponent <CardUIBackground>();
        illustration = Instantiate(LinkedCardInfo.cardIllustrationPref, graphicsRootRef).GetComponent <CardUIIllustration>();
        foreground   = Instantiate(LinkedCardInfo.cardForegroundInfoPref, graphicsRootRef).GetComponent <CardUIForeground>();

        //initialize the components
        illustration.Initialize(LinkedCardInfo, this);
        foreground.Initialize(LinkedCardInfo);
    }