예제 #1
0
파일: GameMode.cs 프로젝트: mrdivdiz/bpvita
    public void Initialize(LevelManager newLevelManager)
    {
        EventManager.Connect(new EventManager.OnEvent <UIEvent>(this.ReceiveUIEvent));
        EventManager.Connect(new EventManager.OnEvent <Pig.PigOutOfBounds>(this.OnPigOutOfBounds));
        this.levelManager = newLevelManager;
        this.levelStart   = WPFMonoBehaviour.FindSceneObjectOfType <LevelStart>();
        Vector3 position = (!this.levelStart) ? Vector3.zero : this.levelStart.transform.position;

        if (this.gameData.m_contraptionPrefab)
        {
            Transform transform = UnityEngine.Object.Instantiate(this.gameData.m_contraptionPrefab, position, Quaternion.identity);
            this.ContraptionProto = transform.GetComponent <Contraption>();
        }
        if (this.gameData.m_hudPrefab)
        {
            Transform transform2 = UnityEngine.Object.Instantiate(this.gameData.m_hudPrefab, position, Quaternion.identity);
            transform2.parent = this.levelManager.transform;
        }
        if (!this.ContraptionProto)
        {
            this.ContraptionProto = WPFMonoBehaviour.FindSceneObjectOfType <Contraption>();
        }
    }