Inheritance: MonoBehaviour
Example #1
0
        public void OnDestroy()
        {
            //By default, NetworkManager destroys game objects that were spawned into the game via NetworkServer.Spawn() or NetworkServer.SpawnWithClientAuthority().
            //This is why NetworkBehaviours and MonoBehaviours could not fire OnPlayerDisconnected() and OnDisconnectedFromServer() event methods. The
            //game objects the NetworkBehaviours and MonoBehaviours had been attached to are destroyed before they have the chance to fire the event methods.

            //This hasAuthority flag checking is still required, just like any other event methods from NetworkBehaviours.
            if (!this.hasAuthority)
            {
                return;
            }

            //This is called to destroy the camera panning. When the game ends, the player shouldn't be moving around.
            GameObject[] cams = GameObject.FindGameObjectsWithTag("MainCamera");
            foreach (GameObject cam in cams)
            {
                CameraPanning panning = cam.GetComponent <CameraPanning>();
                if (panning != null)
                {
                    GameObject minimap = GameObject.FindGameObjectWithTag("Minimap");
                    if (minimap != null)
                    {
                        MinimapStuffs stuffs = minimap.GetComponent <MinimapStuffs>();
                        if (stuffs != null)
                        {
                            stuffs.playerCameraPanning = null;
                        }
                    }

                    Debug.Log("Destroying camera panning.");
                    Destroy(panning);
                }
            }
        }
Example #2
0
        public void RpcLog()
        {
            //First, checks to see what type of recipient is receiving this message. If it's server, the output message should tell the user what the type is.
            Debug.Log("RPC: This is " + (this.isServer ? " Server" : " Client"));

            //Second, initialize everything that is common for both server and client.
            //Camera stuff
            GameObject[] cameraObjects = GameObject.FindGameObjectsWithTag("MainCamera");
            foreach (GameObject cam in cameraObjects)
            {
                GameObject minimap = GameObject.FindGameObjectWithTag("Minimap");
                if (minimap != null)
                {
                    Material borderMaterial = Resources.Load <Material>("Border");
                    if (borderMaterial != null)
                    {
                        if (cam.GetComponent <PostRenderer>() == null)
                        {
                            cam.AddComponent <PostRenderer>();
                        }
                        PostRenderer postRenderer = cam.GetComponent <PostRenderer>();
                        if (postRenderer != null)
                        {
                            postRenderer.borderMaterial = borderMaterial;
                            postRenderer.minimapCamera  = minimap.GetComponent <Camera>();
                            if (postRenderer.minimapCamera == null)
                            {
                                Debug.LogError("Unable to assign minimap camera to post renderer.");
                            }
                        }
                    }

                    if (cam.GetComponent <CameraPanning>() == null)
                    {
                        Debug.Log("Camera Panning is added to camera. Please check.");
                        CameraPanning panning = cam.AddComponent <CameraPanning>();
                        MinimapStuffs stuffs  = minimap.GetComponent <MinimapStuffs>();
                        if (stuffs != null)
                        {
                            stuffs.playerCameraPanning = panning;
                        }
                        panning.cameraPanning = true;
                    }
                    else
                    {
                        if (!cam.GetComponent <CameraPanning>().cameraPanning)
                        {
                            cam.GetComponent <CameraPanning>().cameraPanning = true;
                        }
                    }
                }
            }

            //Finally, initialize server only stuff or client only stuff.
            //Also, finally found a use-case for [Server] / [ServerCallback]. Simplifies things a bit.
            ServerInitialize();
        }
 public override void Interaction()
 {
     base.Interaction();
     if (!completed && !isModuleOpen)
     {
         isModuleOpen = true;
         CameraPanning panning = GetComponent <CameraPanning>();
         if (panning != null)
         {
             panning.ActivateCinematic();
         }
     }
 }
Example #4
0
 // Use this for initialization
 void Start()
 {
     //_charCam.SetActive(false);
     CamPanScript = GameObject.FindGameObjectWithTag("Camera").GetComponent <CameraPanning>();
     _dScript     = GameObject.FindGameObjectWithTag("GulnazBody").GetComponent <DialogueScript>();
     _camChar.GetComponent <Camera>();
     _movieCam.GetComponent <Camera>();
     _camChar.enabled = false;
     deshControl      = GameObject.FindGameObjectWithTag("desh").GetComponent <Animator>();
     _desh            = GameObject.FindGameObjectWithTag("desh").GetComponent <NavMeshAgent>();
     _moveScript      = GameObject.FindGameObjectWithTag("Player").GetComponent <MovementController>();
     _dTutScript      = GameObject.FindGameObjectWithTag("desh").GetComponent <DeshTutorial>();
     _Gulnaz          = GameObject.FindGameObjectWithTag("Player");
 }
 // Use this for initialization
 void Start()
 {
     //_charCam.SetActive(false);
     CamPanScript = GameObject.FindGameObjectWithTag("Camera").GetComponent<CameraPanning>();
     _dScript = GameObject.FindGameObjectWithTag("GulnazBody").GetComponent<DialogueScript>();
     _camChar.GetComponent<Camera>();
     _movieCam.GetComponent<Camera>();
     _camChar.enabled = false;
     deshControl = GameObject.FindGameObjectWithTag("desh").GetComponent<Animator>();
     _desh = GameObject.FindGameObjectWithTag("desh").GetComponent<NavMeshAgent>();
     _moveScript = GameObject.FindGameObjectWithTag("Player").GetComponent<MovementController>();
     _dTutScript = GameObject.FindGameObjectWithTag("desh").GetComponent<DeshTutorial>();
     _Gulnaz = GameObject.FindGameObjectWithTag("Player");
 }
Example #6
0
 public void RpcDestroy()
 {
     GameObject[] cams = GameObject.FindGameObjectsWithTag("MainCamera");
     foreach (GameObject cam in cams)
     {
         CameraPanning camPan = cam.GetComponent <CameraPanning>();
         if (camPan != null)
         {
             Debug.Log("Destroying camPan. Check!");
             GameObject.Destroy(camPan);
             GameObject.Destroy(cam.GetComponent <PostRenderer>());
         }
     }
 }
/***
 *    ██████╗ ██████╗ ██╗██╗   ██╗ █████╗ ████████╗███████╗    ███████╗██╗   ██╗███╗   ██╗ ██████╗████████╗██╗ ██████╗ ███╗   ██╗
 *    ██╔══██╗██╔══██╗██║██║   ██║██╔══██╗╚══██╔══╝██╔════╝    ██╔════╝██║   ██║████╗  ██║██╔════╝╚══██╔══╝██║██╔═══██╗████╗  ██║
 *    ██████╔╝██████╔╝██║██║   ██║███████║   ██║   █████╗      █████╗  ██║   ██║██╔██╗ ██║██║        ██║   ██║██║   ██║██╔██╗ ██║
 *    ██╔═══╝ ██╔══██╗██║╚██╗ ██╔╝██╔══██║   ██║   ██╔══╝      ██╔══╝  ██║   ██║██║╚██╗██║██║        ██║   ██║██║   ██║██║╚██╗██║
 *    ██║     ██║  ██║██║ ╚████╔╝ ██║  ██║   ██║   ███████╗    ██║     ╚██████╔╝██║ ╚████║╚██████╗   ██║   ██║╚██████╔╝██║ ╚████║
 *    ╚═╝     ╚═╝  ╚═╝╚═╝  ╚═══╝  ╚═╝  ╚═╝   ╚═╝   ╚══════╝    ╚═╝      ╚═════╝ ╚═╝  ╚═══╝ ╚═════╝   ╚═╝   ╚═╝ ╚═════╝ ╚═╝  ╚═══╝
 *
 */

    private void PreInitialization()
    {
        string equation = "";

        Dropdown[] difficultyOptions = this.optionsMenu.GetComponentsInChildren <Dropdown>(true);
        foreach (Dropdown dropdown in difficultyOptions)
        {
            Dropdown.OptionData data;
            switch (dropdown.value)
            {
            default:
            case 0:
                data     = dropdown.options[dropdown.value];
                equation = data.text.Substring(0, data.text.Length - "(Easy)".Length);
                break;

            case 1:
                data     = dropdown.options[dropdown.value];
                equation = data.text.Substring(0, data.text.Length - "(Normal)".Length);
                break;

            case 2:
                data     = dropdown.options[dropdown.value];
                equation = data.text.Substring(0, data.text.Length - "(Hard)".Length);
                break;

            case 3:
                break;
            }
        }

        if (equation.Length > 0)
        {
            InputField[] equationsFields = this.unitAttributeEditor.GetComponentsInChildren <InputField>(true);
            foreach (InputField field in equationsFields)
            {
                field.text = equation;
                field.textComponent.text = equation;
            }
        }

        //NOTE(Thompson): Check to make sure camera have camera panning, else do not add any more.
        if (Camera.main.gameObject.GetComponent <CameraPanning>() == null)
        {
            CameraPanning panning = Camera.main.gameObject.AddComponent <CameraPanning>();
            panning.zoomLevel = 5;
        }
    }
        public void Start()
        {
            TutorialAIManager.Instance = this;

            this.isInitialized = false;

            this.isTutorialFinished = false;
            this.delay = 0f;
            this.delayInterval = 0f;
            this.dialogueSectionCounter = 0;
            this.currentTutorialStage = Parts.Introduction;
            this.dialogue = StringConstants.Values(this.currentTutorialStage, this.dialogueSectionCounter);
            this.dialogueSectionCounter++;
            this.stringLetterCounter = 0;
            this.startTextRollingFlag = true;
            if (this.dialogueText != null) {
                this.dialogueText.text = "";
            }
            if (this.mainCamera == null) {
                Debug.LogError("Cannot obtain main camera. Please check.");
            }
            this.cameraOrigin = this.mainCamera.transform.position;

            this.mainCameraPanning = this.mainCamera.GetComponent<CameraPanning>();
            if (this.mainCameraPanning != null) {
                this.mainCameraPanning.enabled = false;
            }
            this.minimapCamera = this.minimap.GetComponent<Camera>();
            if (this.minimapCamera != null) {
                this.minimapCamera.enabled = false;
            }
            if (this.minimap == null) {
                Debug.LogError("Couldn't obtain minimap stuffs. Please check.");
            }
            if (this.nextStepButton == null) {
                Debug.LogError("The next button isn't set.");
            }
            if (this.dialogueText == null) {
                Debug.LogError("Dialogue text field is not bind to this variable.");
            }
            if (this.tutorialSections == null) {
                Debug.LogError("Tutorial sections are not set.");
            }
            if (this.dialogueBox == null) {
                Debug.LogError("Dialogue box not set.");
            }

            //Cursor setup
            GameObject obj = MonoBehaviour.Instantiate(this.cursorPrefab) as GameObject;
            obj.transform.SetParent(this.mainCanvas.transform);
            this.mainCursor = obj.GetComponent<Cursor>();
            if (this.mainCursor == null) {
                Debug.LogError("Cursor isn't obtained. Please check.");
            }

            InitializeCursorPanGroups();
            InitializeTutorial();
        }
Example #9
0
        public void Start()
        {
            TutorialAIManager.Instance = this;

            this.isInitialized = false;

            this.isTutorialFinished = false;
            this.delay                  = 0f;
            this.delayInterval          = 0f;
            this.dialogueSectionCounter = 0;
            this.currentTutorialStage   = Parts.Introduction;
            this.dialogue               = StringConstants.Values(this.currentTutorialStage, this.dialogueSectionCounter);
            this.dialogueSectionCounter++;
            this.stringLetterCounter  = 0;
            this.startTextRollingFlag = true;
            if (this.dialogueText != null)
            {
                this.dialogueText.text = "";
            }
            if (this.mainCamera == null)
            {
                Debug.LogError("Cannot obtain main camera. Please check.");
            }
            this.cameraOrigin = this.mainCamera.transform.position;

            this.mainCameraPanning = this.mainCamera.GetComponent <CameraPanning>();
            if (this.mainCameraPanning != null)
            {
                this.mainCameraPanning.enabled = false;
            }
            this.minimapCamera = this.minimap.GetComponent <Camera>();
            if (this.minimapCamera != null)
            {
                this.minimapCamera.enabled = false;
            }
            if (this.minimap == null)
            {
                Debug.LogError("Couldn't obtain minimap stuffs. Please check.");
            }
            if (this.nextStepButton == null)
            {
                Debug.LogError("The next button isn't set.");
            }
            if (this.dialogueText == null)
            {
                Debug.LogError("Dialogue text field is not bind to this variable.");
            }
            if (this.tutorialSections == null)
            {
                Debug.LogError("Tutorial sections are not set.");
            }
            if (this.dialogueBox == null)
            {
                Debug.LogError("Dialogue box not set.");
            }

            //Cursor setup
            GameObject obj = MonoBehaviour.Instantiate(this.cursorPrefab) as GameObject;

            obj.transform.SetParent(this.mainCanvas.transform);
            this.mainCursor = obj.GetComponent <Cursor>();
            if (this.mainCursor == null)
            {
                Debug.LogError("Cursor isn't obtained. Please check.");
            }

            InitializeCursorPanGroups();
            InitializeTutorial();
        }