Exemple #1
0
    private void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.tag == "Player")
        {
            p = other.gameObject;
            Vector3 p_refl_pos;

            p_refl_pos = MirrorManager.Obj_Refl_Pos(mirror_direction_, p.transform.position);

            // instatiate reflected player
            p_ins = GameObject.Instantiate(p.gameObject, p_refl_pos, Quaternion.identity);

            // change reflected player tag
            p_ins.gameObject.tag   = "Player_ins";
            p_ins.gameObject.layer = LayerMask.NameToLayer("Player_ins");

            // disable the "Player_Movement" in reflected player
            p_ins.gameObject.GetComponent <PlayerMovement>().enabled = false;

            // now we know that the main player is in the mirror area
            p.gameObject.GetComponent <PlayerMovement>().IsInTheMirror = true;

            var last_pos_ins  = p_ins.transform.position;
            var last_pos_main = p.transform.position;

            var p_rb     = p.gameObject.GetComponent <Rigidbody>();
            var p_ins_rb = p_ins.gameObject.GetComponent <Rigidbody>();

            enabled = true;

            mirrorData = new mirrorData(p_ins, p, p_ins_rb, p_rb, last_pos_ins, last_pos_main, mirror_direction_);
            MirrorManager.singletone.AddMirror(mirrorData);
        }
    }
Exemple #2
0
 void Awake()
 {
     audioSource   = GetComponent <AudioSource>();
     mirrorManager = GameObject.Find("MirrorManager").GetComponent <MirrorManager>();
     player        = GameObject.Find("Player");
     playerVision  = GameObject.Find("Player").GetComponent <PlayerVision>();
     sr            = GetComponent <SpriteRenderer>();
 }
Exemple #3
0
    void Awake()
    {
        GameObject game = GameObject.Find("Game State Controller");

        if (game == null)
        {
            Debug.LogError("UIManager: Can not find Game State Controller in the scene.\n");
        }
        GameStateController = game.GetComponent <GameStateController>();
        MirrorManager       = game.GetComponent <MirrorManager>();

        MainCanvas = GetComponent <Canvas>();
    }
Exemple #4
0
    private void Awake()
    {
        setupPlayer          = GetComponent <SetupPlayer>();
        playerInfo           = GetComponent <PlayerInfo>();
        playerController     = GetComponent <PlayerController>();
        mirrorManager        = GetComponent <MirrorManager>();
        checkPointController = GetComponent <CheckpointController>();


        //Si esto da problemas, llevarlo al Start
        //polePositionManager = FindObjectOfType<PolePositionManager>();
        //networkController = FindObjectOfType<NetworkController>();
        //UIManager = FindObjectOfType<UIManager>();



        print("ScriptManager SETUP");
    }
Exemple #5
0
    public void KillerAction()
    {
        if (kill)
        {
            //Animator killanim = GetComponent<Animator>();
            //killanim.SetBool("kill", true);
            playerManager = player.GetComponent <PlayerManager>();
            StartCoroutine("AnimCoroutine");
            //playerManager.HP -= 1000;
            playerManager.Damageplayer();
        }
        else if (entermirror)
        {
            mirrorManager  = mirror.GetComponent <MirrorManager>();
            in_mirrorworld = true;
            GetComponent <PlayerMove>().speed  = 21;
            this.gameObject.transform.position = mirrorManager.warppointer.transform.position;
            GetComponent <KillerEffectObject>().InnerMirror = true;
        }
        else if (upstairs)
        {
            up_stair = stairs.GetComponent <UpStairs>();
            this.gameObject.transform.position = up_stair.stairs_up.transform.position;
        }
        else if (downstairs)
        {
            down_stair = stairs.GetComponent <DownStairs>();
            this.gameObject.transform.position = down_stair.stairs_down.transform.position;
        }
        else if (exitmirrorworld)
        {
            mirrorManager  = mirror.GetComponent <MirrorManager>();
            in_mirrorworld = false;;
            GetComponent <PlayerMove>().speed  = 7;
            this.gameObject.transform.position = mirrorManager.warppointer.transform.position;
            GetComponent <KillerEffectObject>().InnerMirror = false;
        }

        kill        = false;
        entermirror = false;
        upstairs    = false;
        downstairs  = false;
    }
 void Awake()
 {
     onPlayerCaught = new UnityEvent();
     onPlayerCaught.AddListener(PlayerCaught);
     onPlayerWin = new UnityEvent();
     onPlayerWin.AddListener(PlayerWin);
     gameMenu      = GameObject.Find("Canvas").GetComponent <GameMenu>();
     gameOverText  = GameObject.Find("GameOverText").GetComponent <Text>();
     mirrorManager = GameObject.Find("MirrorManager").GetComponent <MirrorManager>();
     playerVision  = GameObject.Find("Player").GetComponent <PlayerVision>();
     progressText  = GameObject.Find("ProgressText").GetComponent <Text>();
     stopwatch     = new Stopwatch();
     stopwatch.Start();
     deathAudio  = GetComponent <AudioSource>();
     secretDoors = new Vector3Int[] { new Vector3Int(-14, 11, 0),
                                      new Vector3Int(-14, 12, 0),
                                      new Vector3Int(13, 11, 0),
                                      new Vector3Int(13, 12, 0) };
 }
Exemple #7
0
        private void Application_Startup(object sender, StartupEventArgs e)
        {
            // Save Startup Arguments
            if (e.Args.Length != 0)
            {
                GlobalVar.appStartArgs = e.Args;
            }
            if (GlobalVar.appStartArgs == null)
            {
                FocusAndShutdown();
            }
            else
            {
                if (!GlobalVar.appStartArgs.Contains("--ignoreInstances"))
                {
                    FocusAndShutdown();
                }
            }

            // Check if elevated
            WindowsPrincipal winPrincipal = new WindowsPrincipal(WindowsIdentity.GetCurrent());

            GlobalVar.tool_isElevated = winPrincipal.IsInRole(WindowsBuiltInRole.Administrator);

            // Load language package
            if (Directory.Exists(System.Windows.Forms.Application.StartupPath + "/data/l10n".Replace('/', Path.DirectorySeparatorChar)))
            {
                TranslationManager.translationList = TranslationManager.TranslationMap(System.Windows.Forms.Application.StartupPath + "/data/l10n".Replace('/', Path.DirectorySeparatorChar));
                if (TranslationManager.translationList.ContainsKey(CultureInfo.CurrentCulture.ToString().Substring(0, 5).Replace("-", "_")))
                {
                    TranslationManager.TranslationLoad(TranslationManager.translationList[CultureInfo.CurrentCulture.ToString().Substring(0, 5).Replace("-", "_")].Path);
                }
                else if (TranslationManager.translationList.ContainsKey(CultureInfo.CurrentCulture.ToString().Substring(0, 2)) & !(CultureInfo.CurrentCulture.ToString().Substring(0, 2) == "en"))
                {
                    // Prevent loading of en_UD
                    TranslationManager.TranslationLoad(TranslationManager.translationList[CultureInfo.CurrentCulture.ToString().Substring(0, 2)].Path);
                }
            }

            MirrorManager.LoadMirrors();
        }
Exemple #8
0
    //void CalledOnLevelWasLoaded(int level)
    //{
    // check if we are outside the Arena and if it's the case, spawn around the center of the arena in a safe zone
    //if (!Physics.Raycast(transform.position, -Vector3.up, 5f))
    //{
    //transform.position = new Vector3(0f, 0f, 0f);
    //}
    //}
    #endregion


    public void SurviorAction()
    {
        if (breakmirror)
        {
            mirrormanager = mirror.GetComponent <MirrorManager>();
            StartCoroutine("Breakcoroutine");
            mirrormanager.Breaking();
        }
        else if (upstairs)
        {
            up_stair = stairs.GetComponent <UpStairs>();
            this.gameObject.transform.position = up_stair.stairs_up.transform.position;
        }
        else if (downstairs)
        {
            down_stair = stairs.GetComponent <DownStairs>();
            this.gameObject.transform.position = down_stair.stairs_down.transform.position;
        }

        //breakmirror = false;
        upstairs   = false;
        downstairs = false;
    }
Exemple #9
0
        // Package Info Location Data Ex: chrome;86;https://example.com/chromedownload.json
        public static void InstallPackage(string query)
        {
            WebClient client = new WebClient();

            Screen.PrintLn(":: Updating Repositories");
            MirrorManager.DownloadMirrors();

            string packageInstallJson = "";

            foreach (string mirror in Directory.GetFiles(Config.MirrorFolderLocation))
            {
                string[] fileContent = File.ReadAllLines(mirror);

                foreach (string line in fileContent)
                {
                    string[] lineSplit = line.Split(';');

                    if (line.StartsWith(query))
                    {
                        Screen.Print($":: Package {lineSplit[0]} version {lineSplit[1]} (y/n)? ");
                        ConsoleKeyInfo keypress = Console.ReadKey();

                        if (keypress.KeyChar is 'y' or 'Y')
                        {
                            packageInstallJson = client.DownloadString(lineSplit[2]);
                        }
                        else
                        {
                            client.Dispose();
                            Screen.PrintLn("Ok cancelled.");

                            Environment.Exit(0);
                        }
                    }
                }
            }
Exemple #10
0
    private void Awake()
    {
        instance = this;

        mirrors = new GameObject[(int)Mathf.Pow(DATA.DimensionData.npr, 3)];


        if (wireframeCubeContainer == null)
        {
            wireframeCubeContainer = new GameObject("Wireframe Cube Container");
            wireframeCubeContainer.transform.parent = transform;
        }


        if (mirrorContainer == null)
        {
            mirrorContainer = new GameObject("Mirror Container");
            mirrorContainer.transform.parent = transform;
        }


        print(mirrors.Length + " mirror in total.");

        int i = 0;

        float scale    = DATA.DimensionData.gridSize;
        float diameter = DATA.DimensionData.matrixDiameter;
        float size     = DATA.DimensionData.cubeDia;

        for (int x = 0; x < DATA.DimensionData.npr; x++)
        {
            for (int y = 0; y < DATA.DimensionData.npr; y++)
            {
                for (int z = 0; z < DATA.DimensionData.npr; z++)
                {
                    mirrors[i] = GameObject.CreatePrimitive(PrimitiveType.Cube);
                    mirrors[i].transform.parent     = mirrorContainer.transform;
                    mirrors[i].transform.localScale = new Vector3(size, size, size);
                    mirrors[i].GetComponent <Collider>().enabled = false;
                    mirrors[i].transform.position = new Vector3(x * scale - DATA.DimensionData.matrixDiameter / 2 + transform.position.x,
                                                                y * scale - diameter / 2 + transform.position.y,
                                                                z * scale - diameter / 2 + transform.position.z);
                    mirrors[i].GetComponent <Renderer>().material = mirrorMat;
                    Mirror code = mirrors[i].AddComponent <Mirror>();
                    code.SelfRotate = CubeSelfRotate;
                    code.SpaceID    = new Vector3(x, y, z);

                    int n = DATA.DimensionData.npr;
                    if (x == n / 2 && y == n / 2 && z == n / 2)
                    {
                        centerCube = mirrors[i];
                    }

                    i++;


                    //wireframe
                    GameObject wireframeCube = GameObject.CreatePrimitive(PrimitiveType.Cube);
                    Destroy(wireframeCube.GetComponent <Collider>());
                    wireframeCube.name               = "wireframe Cube";
                    wireframeCube.transform.parent   = transform;
                    wireframeCube.transform.position = new Vector3(x * scale - DATA.DimensionData.matrixDiameter / 2 + transform.position.x,
                                                                   y * scale - diameter / 2 + transform.position.y,
                                                                   z * scale - diameter / 2 + transform.position.z);
                    wireframeCube.transform.localScale = new Vector3(scale, scale, scale);

                    Renderer r = wireframeCube.GetComponent <Renderer>();
                    r.material          = lineMat;
                    r.lightProbeUsage   = UnityEngine.Rendering.LightProbeUsage.Off;
                    r.receiveShadows    = false;
                    r.shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.Off;
                    //wireframeCube.isStatic = true;
                    wireframeCube.transform.parent = wireframeCubeContainer.transform;
                }
            }
        }
    }
Exemple #11
0
 private void Awake()
 {
     singletone = this;
     mirrors_   = new List <mirrorData>();
 }