Exemple #1
0
    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>();
        }
    }