예제 #1
0
        public void PuzzleFinished()
        {
            if (!advCam)
            {
                advCam = PersistentEngine.advCamera;
            }
            advCam.CanCamMove(advCamCanMove);
            puzzle.ToggleShow(false);
            if (disableOnFinish)
            {
                puzzle.gameObject.SetActive(false);
            }
            if (disableCollider)
            {
                transform.GetComponent <Collider2D>().enabled = false;
                colliderDisabled = true;
            }

            if (disableInteractiveItemPuzzleOnFinish)
            {
                this.enabled = false;
            }

            StartCoroutine(FinishProcedure());
            if (removeInventoryItemOnFinish && itemToRemove != null)
            {
                itemToRemove.Remove();
            }

            gameObject.SendMessage("PuzzleCompleted", SendMessageOptions.DontRequireReceiver);
        }
예제 #2
0
        // Use this for initialization
        void Start()
        {
            advCamera = PersistentEngine.advCamera;

            highlightObject = Instantiate(Resources.Load("INTERACTIVEOBJECT_HIGHLIGHT") as GameObject) as GameObject;
            highlightObject.transform.position = transform.position + centerOffset;
            highlightObject.transform.parent   = transform;
            highlightObject.GetComponent <Renderer>().enabled = false;

            if (GetComponent <InteractiveItemSendMessage>() != null)
            {
                canBeUsed = GetComponent <InteractiveItemSendMessage>().canBeUsed;
            }

            if (GetComponent <InteractiveItemConversation>() != null)
            {
                canBeUsed = true;
            }

            if (GetComponent <InteractiveItemPuzzle>() != null)
            {
                canBeUsed = true;
            }

            if (GetComponent <InteractiveItemRotatingStates>() != null)
            {
                canBeUsed = true;
            }

            if (GetComponent <InteractiveItemSwitch>() != null)
            {
                if (GetComponent <InteractiveItemSwitch>().contributesToCanBeUsedFlag)
                {
                    canBeUsed = true;
                }
            }

            if (GetComponent <InventoryItem>() != null)
            {
                canBeUsed = true;
            }

            if (GetComponent <InteractiveItemAnimator>() != null)
            {
                canBeUsed = true;
            }

            if (GetComponent <DoorBetweenLevels>() != null)
            {
                isExit = true;
            }

            if (GetComponent <PersonNPC>() != null)
            {
                isPerson = true;
            }
        }
예제 #3
0
 void Start()
 {
     base.Initialise();
     advCamera           = PersistentEngine.advCamera;
     elroy               = PersistentEngine.player;
     interactiveItemMain = gameObject.GetComponent <InteractiveItem>();
     if (animator == null)
     {
         animator = gameObject.GetComponent <Animator>();
     }
 }
예제 #4
0
        void Start()
        {
            base.Initialise();

            advCam        = PersistentEngine.advCamera;
            advCamCanMove = advCam.canMove;

            connectedSwitch = GetComponent <InteractiveItemSwitch>();
            if (colliderDisabled)
            {
                this.GetComponent <Collider2D>().enabled = false;
            }
        }
예제 #5
0
        // Use this for initialization
        void Start()
        {
            animator = GetComponent <Animator>();

            animHashWalk = Animator.StringToHash("Base Layer.gui-steps");
            animHashLook = Animator.StringToHash("Base Layer.gui-look");
            animHashUse  = Animator.StringToHash("Base Layer.gui-use");
            animHashTalk = Animator.StringToHash("Base Layer.gui-talk");
            animHashExit = Animator.StringToHash("Base Layer.gui-exit");

            myTransform = transform;
            advCamera   = PersistentEngine.advCamera;
        }
        void Start()
        {
            advCamera = PersistentEngine.advCamera;
            if (!cam)
            {
                cam = GetComponentInChildren <Camera>();
            }
            elroy = PersistentEngine.player;

            animator = GetComponent <Animator>();
            if (disableAnimatorOnStart)
            {
                animator.enabled = false;
            }
            cam.enabled = false;
        }
예제 #7
0
파일: Inventory.cs 프로젝트: tadej/enkidu
        void Awake()
        {
            gameObject.name = "Inventory";

            canvas             = GetComponent <Canvas>();
            items              = new ArrayList();
            advCamera          = PersistentEngine.advCamera;
            transform.position = Camera.main.ScreenToWorldPoint(new Vector3(0, 0));
            originalPosition   = parentObject.localPosition;

            if (autoHide)
            {
                StartCoroutine(arrowClickedCoroutine(arrow.gameObject, false));
            }

            UpdateItemPosition_Scroll();
        }
예제 #8
0
        // Use this for initialization
        void Start()
        {
            advCamera = PersistentEngine.advCamera;
            float cameraSize = 4;

            if (advCamera)
            {
                cameraSize = advCamera.cameraSize;
            }
            else
            {
                cameraSize = PersistentEngine.activeCamera.fieldOfView;
            }

            textStrings         = new string[5];
            colorSelected       = new Color32(255, 168, 48, 255);
            colorIdle           = new Color32(255, 243, 197, 255);
            colorShadowSelected = new Color32(32, 53, 63, 255);
            colorShadowIdle     = new Color32(13, 63, 81, 255);
            bg       = background.transform.parent.transform;
            defBgPos = bg.transform.localPosition;
            if (calcFunctions)
            {
                if (PersistentEngine.IsMobileScreen())
                {
                    defBgPos.y = (-cameraSize + defCamSizeForCalc) * multiplierSmall;
                }
                else
                {
                    defBgPos.y = (-cameraSize + defCamSizeForCalc) * multiplierLarge;
                }
                offsetBackground = (cameraSize - defCamSizeForCalc) * secondMultiplier + addedOffest;
            }

            defTextPosKrat = textPosKrat;
            defTextPosPlus = textPosPlus;
            SetEnabled(false);

            shadowOffsetLeft  *= cameraSize / 0.93f;
            shadowOffsetLeft1 *= cameraSize / 0.93f;
            shadowOffsetLeft2 *= cameraSize / 0.93f;
            shadowOffsetDown  *= cameraSize / 0.93f;
            shadowOffsetDown1 *= cameraSize / 0.93f;
            shadowOffsetDown2 *= cameraSize / 0.93f;
        }
예제 #9
0
        public void PuzzleClosed()
        {
            puzzle.ToggleShow(false);
            if (!advCam)
            {
                advCam = PersistentEngine.advCamera;
            }
            advCam.CanCamMove(advCamCanMove);

            if (disableOnClose)
            {
                puzzle.gameObject.SetActive(false);
            }
            PersistentEngine.player.SetInCutScene(false);
            StartCoroutine(CloseProcedure());

            PersistentEngine.player.StopTalking();
        }
예제 #10
0
        IEnumerator ShowPuzzleProcedure()
        {
            if (!puzzle.gameObject.activeInHierarchy)
            {
                puzzle.gameObject.SetActive(true);
            }
            yield return(null);

            if (!puzzle.gameObject.activeInHierarchy)
            {
                puzzle.gameObject.SetActive(true);
            }
            yield return(null);

            puzzle.puzzle = this;
            puzzle.ToggleShow(true);
            if (!advCam)
            {
                advCam = PersistentEngine.advCamera;
            }

            advCam.CanCamMove(false);
            StartCoroutine(ShowComments());
        }
예제 #11
0
        void Awake()
        {
            float starttime = Time.realtimeSinceStartup;

            Debug.Log("Global Awake: Init: " + starttime);

            if (SceneManager.GetActiveScene().buildIndex == 0)
            {
                initialized = false;
                state       = new Hashtable();
                Initialize();
            }
            isMobileScreen = isSmallScreenL;

            var men = Resources.Load("prefabs/Menus") as GameObject;

            var meni = Instantiate(men);

            meni.name = "Menus";

            var dt  = Resources.Load("prefabs/CharacterDialogText") as GameObject;
            var dti = Instantiate(dt);

            dti.name = "CharacterDialogText";

            var dc  = Resources.Load("prefabs/DialogControl") as GameObject;
            var dci = Instantiate(dc);

            dci.name = "DialogControl";

            PersistentEngine.characterDialogText = dti.GetComponent <CharacterDialogText>();

            player = GameObject.FindObjectOfType <Player>() ? GameObject.FindObjectOfType <Player>().GetComponent <Player>() : null;

            advCamera = GameObject.Find("MainCamera") ? GameObject.Find("MainCamera").GetComponent <AdvCamera>() : null;

            if (advCamera == null)
            {
                advCamera = GameObject.Find("Main Camera Runner") ? GameObject.Find("Main Camera Runner").GetComponent <AdvCamera>() : null;
            }

            navMeshAgent = GameObject.Find("NavmeshAgent") ? GameObject.Find("NavmeshAgent").GetComponent <UnityEngine.AI.NavMeshAgent>() : null;

            scene = GameObject.Find("Scene") ? GameObject.Find("Scene").GetComponent <Scene>() : null;

            customCursor = GameObject.Find("CustomCursor") ? GameObject.Find("CustomCursor").GetComponent <CustomCursor>() : null;
            customCursor.gameObject.SetActive(true);
            if (advCamera && PersistentEngine.activeCamera == null)
            {
                PersistentEngine.activeCamera = advCamera.GetComponent <Camera>();
            }

            if (PersistentEngine.activeCamera == null && Camera.main)
            {
                PersistentEngine.activeCamera = Camera.main;
            }

            bool   inBuildSettings = true;
            String current         = SceneManager.GetActiveScene().path;

            var bf = Resources.Load("prefabs/BlackFade") as GameObject;

            var bfi = Instantiate(bf);

            bfi.name = "BlackFade";
            GameObject Fade = GameObject.Find("BlackFade");

            blackFade = Fade.GetComponent <SpriteRenderer>();

            if (!inBuildSettings || SceneManager.GetActiveScene().buildIndex < SceneManager.sceneCountInBuildSettings - 1)
            {
                audioManager = GameObject.Find("AudioManager").GetComponent <AudioManager>();

                audioManager.Initialise();

                SetMusic(GetState("Global music") == 1 || GetState("Global music") == -1);
                SetSound(GetState("Global sound") == 1 || GetState("Global sound") == -1);
                int?savegameSlot = GetState("Global Savegame");
                if (savegameSlot == null)
                {
                    savegameSlot = 1;
                }
                SetSavegame((int)savegameSlot);


                if (SceneManager.GetActiveScene().buildIndex > 0 && GetState("Global level") != SceneManager.GetActiveScene().buildIndex)
                {
                    SetState("Global level", SceneManager.GetActiveScene().buildIndex, true);
                }

                float endTime = Time.realtimeSinceStartup;

                float timePassed = endTime - starttime;

                Debug.Log("Global Awake: Init End: " + endTime + " time passed: " + timePassed);
            }

            blackFade.color = new Color(1, 1, 1, 1);

            if (string.IsNullOrEmpty(GetArrivalDoor()) && !string.IsNullOrEmpty(arrivalDoor))
            {
                SetArrivalDoor(arrivalDoor);
            }
        }
예제 #12
0
 void Awake()
 {
     advCamera = PersistentEngine.advCamera;
 }