Ejemplo n.º 1
0
    public void Init()
    {
        scoresUI   = new List <GameObject>();
        scores     = new List <int>();
        m_initGame = GameObject.Find("InitGame").GetComponent <InitGame>();
        GameObject[] players = GameObject.FindGameObjectsWithTag("Player");
        List <int>   equipos = new List <int>();

        foreach (GameObject go in players)
        {
            if (!equipos.Contains(go.GetComponent <PlayerStats>().teamId))
            {
                equipos.Add(go.GetComponent <PlayerStats>().teamId);
            }
        }
        m_nTeams = equipos.Count;

        for (int i = 0; i < m_nTeams; i++)
        {
            Vector2    pos = new Vector2(105f * i - 105f, Screen.height / 2);
            GameObject go  = Instantiate(scoreUI);
            go.GetComponentInChildren <Image>().color = m_initGame.teamColors[i];
            go.transform.SetParent(m_canvas.transform);
            go.transform.localPosition = pos;
            scoresUI.Add(go);
            scores.Add(m_vidas);
            Refresh(i + 1);
        }
        m_gameStarted = true;
    }
Ejemplo n.º 2
0
    public void LogOut()
    {
        PlayerPrefs.SetString("token", "");
        InitGame init = GameObject.Find("Main Camera").GetComponent <InitGame>();

        init.Init();
    }
Ejemplo n.º 3
0
    void Start()
    {
        rend = GetComponent <Renderer>();
        GameObject InitEmpty = GameObject.Find("InitObject");

        InitGame = InitEmpty.GetComponent <InitGame>();
    }
Ejemplo n.º 4
0
 // Start is called before the first frame update
 void Start()
 {
     initObject = GameObject.Find("InitObject");
     initGame   = initObject.GetComponent <InitGame>();
     StartCoroutine("Tiempojuego");
     tiempodejuego = 0.00f;
 }
Ejemplo n.º 5
0
    public async void Auth()
    {
        string name     = inputNameRegister.text;
        string password = inputPasswordRegister.text;

        client = new ChessClient.ChessClient(host, name);
        try
        {
            load.SetActive(true);
            string response = await client.Authentication(host + "Token/gettoken/", name, password);

            AuthRes authRes = JsonUtility.FromJson <AuthRes>(response);
            load.SetActive(false);
            message.text = authRes.Item2 + " успешно авторизован";
            PlayerPrefs.SetString("name", authRes.Item2);
            PlayerPrefs.SetString("token", "Bearer " + authRes.Item1);
            panel.SetActive(false);
            InitGame init = GameObject.Find("Main Camera").GetComponent <InitGame>();
            init.Init();
        }
        catch (WebException ex)
        {
            if (ex.Response == null)
            {
                message.text = "Инет вруби";
                load.SetActive(false);
                return;
            }
            message.text = "Неправильно введен логин или пароль";
            load.SetActive(false);
        }
    }
 public virtual void OnInitGame(InitGame args)
 {
     if (InitGame != null)
     {
         InitGame(args);
     }
 }
Ejemplo n.º 7
0
 // Start is called before the first frame update
 void Start()
 {
     SpaceShip     = GameObject.Find("StarSparrow1");
     spaceshipMove = SpaceShip.GetComponent <SpaceshipMove>();
     initObject    = GameObject.Find("InitObject");
     initGame      = initObject.GetComponent <InitGame>();
     obstacleSpeed = initGame.speed;
 }
Ejemplo n.º 8
0
    void Update()
    {
        if (!win)
        {
            if (paused)
            {
                print("paused");
                if (Input.GetKeyDown(KeyCode.P))
                {
                    unPause();
                    paused = false;
                }
                else if (Input.GetKeyDown(KeyCode.R))
                {
                    unPause();
                    paused = false;
                    InitGame.loseGame();
                }
                else
                {
                    return;
                }
            }
            else if (Input.GetKeyDown(KeyCode.P) && !paused)
            {
                paused = true;

                displayPause();
            }

            if (yPos == transform.position.y)
            {
                moveDirection.y = 0;
            }
            yPos = transform.position.y;
            CharacterController controller = GetComponent <CharacterController>();
            if (controller.isGrounded)
            {
                moveDirection  = new Vector3(-Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical"));
                moveDirection  = transform.TransformDirection(moveDirection);
                moveDirection *= speed;
                if (Input.GetButton("Jump"))
                {
                    moveDirection.y = jumpSpeed;
                }
            }

            rotY += Input.GetAxis("Mouse Y") * 3f;
            rotY  = Mathf.Clamp(rotY, -80, 80);
            Quaternion yQuaternion = Quaternion.AngleAxis(rotY, -Vector3.right);
            cam.transform.localRotation = oRot * yQuaternion;

            transform.Rotate(0, 4 * Input.GetAxis("Mouse X"), 0);

            moveDirection.y -= gravity * Time.deltaTime;
            controller.Move(moveDirection * Time.deltaTime);
        }
    }
Ejemplo n.º 9
0
    void MoverNave()
    {
        float desplX = Input.GetAxis("Horizontal");
        float desplY = Input.GetAxis("Vertical");

        float myPosY = transform.position.y;
        float myPosX = transform.position.x;



        if (myPosX < -4.5 && desplX < 0)
        {
            inMarginMoveX = false;
        }
        else if (myPosX < -4.5 && desplX > 0)
        {
            inMarginMoveX = true;
        }
        else if (myPosX > 4.5 && desplX > 0)
        {
            inMarginMoveX = false;
        }
        else if (myPosX > 4.5 && desplX < 0)
        {
            inMarginMoveX = true;
        }
        //Retricción en Y
        if (myPosY < -0 && desplY < 0)
        {
            inMarginMoveY = false;
        }
        else if (myPosY < -0 && desplY > 0)
        {
            inMarginMoveY = true;
        }
        else if (myPosY > 4 && desplY > 0)
        {
            inMarginMoveY = false;
        }
        else if (myPosY > 4 && desplY < 0)
        {
            inMarginMoveY = true;
        }

        initGame = initObject.GetComponent <InitGame>();
        if (inMarginMoveX)
        {
            transform.Translate(Vector3.right * Time.deltaTime * initGame.speed * desplX, Space.World);
        }
        if (inMarginMoveY)
        {
            transform.Translate(Vector3.up * Time.deltaTime * initGame.speed * desplY, Space.World);
        }

        transform.rotation = Quaternion.Euler(desplY * -20, 0, desplX * -20);
    }
Ejemplo n.º 10
0
 void Awake()
 {
     //Init Zombienite
     Debug.LogError("Change this Script for your own Script");
     if (instance == null)
     {
         instance = this;
         game     = GetComponentInChildren <InitGame>();
     }
 }
Ejemplo n.º 11
0
    private void Awake()
    {
        if (Instance != null)
        {
            return;
        }

        Instance            = this;
        Screen.sleepTimeout = SleepTimeout.NeverSleep;
        StartCoroutine(LoadGame());
        DontDestroyOnLoad(gameObject);
    }
Ejemplo n.º 12
0
    void OnTriggerEnter(Collider other)
    {
        //print("hi there you collided with stairs");
        if (!hasPausedLava)
        {
            InitGame.stairPause();
            hasPausedLava = true;
            print("just stair paused lava");

            rend1.material = usedStairs;
            rend2.material = usedStairs;
        }
    }
Ejemplo n.º 13
0
 void Start()
 {
     ui                 = UI.GetComponent <UI>();
     initGame           = InitGame.GetComponent <InitGame>();
     variablemuerto     = 1;
     transform.position = new Vector3(0, 2, 0);
     speednave          = 10;
     audioSource        = GetComponent <AudioSource>();
     GameOverCanvas.SetActive(false);
     visibilidadExplosion.enabled = false;
     StartCoroutine("lowHPSound");
     explosionparticulas.SetActive(false);
     explosionparticulas2.SetActive(false);
 }
Ejemplo n.º 14
0
    public async void Register()
    {
        string name     = inputNameRegister.text;
        string password = inputPasswordRegister.text;
        string email    = inputEmailRegister.text;

        client = new ChessClient.ChessClient(host, name);
        try
        {
            load.SetActive(true);
            if (!Regex.IsMatch(email, pattern))
            {
                message.text = "Неверный email";
                return;
            }
            await client.RegisterUser(host + "Users", name, password, email);

            load.SetActive(false);
            message.gameObject.SetActive(true);
            message.text = "Вы успешно зарегистрованы";
            panel.SetActive(false);
            InitGame init = GameObject.Find("Main Camera").GetComponent <InitGame>();
            init.Init("Вы успешно зарегистрованы");
        }
        catch (WebException ex)
        {
            if (ex.Response == null)
            {
                message.text = "Инет вруби";
                load.SetActive(false);
                return;
            }
            Stream       errorResponse  = ex.Response.GetResponseStream();
            StreamReader reader         = new StreamReader(errorResponse, Encoding.UTF8);
            string       responseString = reader.ReadToEnd();
            try
            {
                Messages mes = JsonUtility.FromJson <Messages>(responseString);
                load.SetActive(false);
                message.text = mes.Message;
            }
            catch
            {
                message.text = ex.Message;
                load.SetActive(false);
            }
        }
    }
Ejemplo n.º 15
0
    private async Task PostData_Async()
    {
        InitGame init = new InitGame()
        {
            userId = "lau"
        };

        var         data    = JsonUtility.ToJson(init);
        HttpContent content = new StringContent(data, System.Text.Encoding.UTF8, "application/json");

        var response = await client.PostAsync(baseURL + "newgame", content);

        if (response.IsSuccessStatusCode)
        {
            var result = await response.Content.ReadAsStringAsync();

            this.game = JsonUtility.FromJson <Game>(result);
        }
    }
Ejemplo n.º 16
0
 public void StartGame(string functor, string[] initialPair, bool spoiler)
 {
     InitGame.Invoke(this, new ViewEvent_Game("test", functor, initialPair, spoiler));
 }
Ejemplo n.º 17
0
 // Start is called before the first frame update
 void Start()
 {
     initGame = InitGame.GetComponent <InitGame>();
     ui       = UI.GetComponent <UI>();
 }
        static IconInteractionUtility()
        {
            string hookCostumePath = Path.Combine(Settings.Default.CityOfHeroesGameDirectory, "HookCostume.dll");

            //Shared.Logging.FileLogManager.ForceLog(hookCostumePath);
            dllHandle = WindowsUtilities.LoadLibrary(hookCostumePath);
            if (dllHandle != null)
            {
                IntPtr initGameAddress = WindowsUtilities.GetProcAddress(dllHandle, "InitGame");
                if (initGameAddress != IntPtr.Zero)
                {
                    initGame = (InitGame)(Marshal.GetDelegateForFunctionPointer(initGameAddress, typeof(InitGame)));
                    //Shared.Logging.FileLogManager.ForceLog("Init Game Located");
                }

                IntPtr closeGameAddress = WindowsUtilities.GetProcAddress(dllHandle, "CloseGame");
                if (closeGameAddress != IntPtr.Zero)
                {
                    closeGame = (CloseGame)(Marshal.GetDelegateForFunctionPointer(closeGameAddress, typeof(CloseGame)));
                    //Shared.Logging.FileLogManager.ForceLog("Close Game Located");
                }

                IntPtr setUserHWndAddress = WindowsUtilities.GetProcAddress(dllHandle, "SetUserHWND");
                if (setUserHWndAddress != IntPtr.Zero)
                {
                    setUserHWnd = (SetUserHWND)(Marshal.GetDelegateForFunctionPointer(setUserHWndAddress, typeof(SetUserHWND)));
                    //Shared.Logging.FileLogManager.ForceLog("Set User HWND Located");
                }

                IntPtr executeCmdAddress = WindowsUtilities.GetProcAddress(dllHandle, "ExecuteCommand");
                if (executeCmdAddress != IntPtr.Zero)
                {
                    executeCmd = (ExecuteCommand)(Marshal.GetDelegateForFunctionPointer(executeCmdAddress, typeof(ExecuteCommand)));
                    //Shared.Logging.FileLogManager.ForceLog("Execute Command Located");
                }

                IntPtr getHoveredNPCInfoAddress = WindowsUtilities.GetProcAddress(dllHandle, "GetHoveredNPCInfo");
                if (getHoveredNPCInfoAddress != IntPtr.Zero)
                {
                    getHoveredNPCInfo = (GetHoveredNPCInfo)(Marshal.GetDelegateForFunctionPointer(getHoveredNPCInfoAddress, typeof(GetHoveredNPCInfo)));
                    //Shared.Logging.FileLogManager.ForceLog("Get Hovered NPC Info Located");
                }

                IntPtr getMouseXYZInGameAddress = WindowsUtilities.GetProcAddress(dllHandle, "GetMouseXYZInGame");
                if (getMouseXYZInGameAddress != IntPtr.Zero)
                {
                    getMouseXYZInGame = (GetMouseXYZInGame)(Marshal.GetDelegateForFunctionPointer(getMouseXYZInGameAddress, typeof(GetMouseXYZInGame)));
                    //Shared.Logging.FileLogManager.ForceLog("Get Mouse XYZ Located");
                }

                IntPtr checkGameDoneAddress = WindowsUtilities.GetProcAddress(dllHandle, "CheckGameDone");
                if (checkGameDoneAddress != IntPtr.Zero)
                {
                    checkIfGameLoaded = (CheckIfGameLoaded)(Marshal.GetDelegateForFunctionPointer(checkGameDoneAddress, typeof(CheckIfGameLoaded)));
                    //Shared.Logging.FileLogManager.ForceLog("Check Game Done Located");
                }

                IntPtr detectCollisionAddress = WindowsUtilities.GetProcAddress(dllHandle, "CollisionDetection");
                if (detectCollisionAddress != IntPtr.Zero)
                {
                    detectCollision = (DetectCollision)(Marshal.GetDelegateForFunctionPointer(detectCollisionAddress, typeof(DetectCollision)));
                    //Shared.Logging.FileLogManager.ForceLog("Collision Detection Located");
                }
            }
        }
Ejemplo n.º 19
0
 // Start is called before the first frame update
 void Start()
 {
     initGame    = InitGame.GetComponent <InitGame>();
     audioSource = GetComponent <AudioSource>();
 }
Ejemplo n.º 20
0
 private void Start()
 {
     dm       = GameObject.Find("DifficultyManager").GetComponent <DifficultyManager>();
     initGame = GameObject.Find("DifficultyManager").GetComponent <InitGame>();
 }
Ejemplo n.º 21
0
    public void initCity()
    {
        print("initing city!");
        Building startBuilding = Instantiate(buildingPrefab);

        startBuilding.transform.localPosition = new Vector3(xstart, 0, zstart);
        startBuilding.transform.SetParent(transform);
        startBuilding.setPos(xstart, zstart);
        startBuilding.setStartingLevel(0);
        int startSize = generateRandomBuildingSize();

        occupyBuildingSpace(xstart, zstart, startSize, startBuilding);
        startBuilding.generateMazeFloor(Random.Range(1, startSize - 1), 0, 'N', 0, new MazeUnit[startSize, startSize], startSize);
        startBuilding.setSource(null);
        buildingList.Add(startBuilding);
        findTallestBuilding.Add(startBuilding);
        finalBuildingList.Add(startBuilding);

        int testcounter = 0;

        while (buildingList.Count > 0 && testcounter < 100)
        {
            testcounter++;
            Building curr            = buildingList[0];
            int      count           = 0;
            char     dir             = generateRandomDirection();
            int      xdir            = generateRandomDistanceBetweenBuilding();
            int      zdir            = generateRandomDistanceBetweenBuilding();
            int      newBuildingSize = generateRandomBuildingSize();

            while (count < 4 && !isValidBuildingSpace(XafterDirection(dir, curr, xdir), ZafterDirection(dir, curr, zdir), newBuildingSize))
            {
                count++;
                dir = generateRandomDirection();
            }

            if (!isValidBuildingSpace(XafterDirection(dir, curr, xdir), ZafterDirection(dir, curr, zdir), newBuildingSize))
            {
                buildingList.Remove(curr);
            }
            else
            {
                int      newBuildingXPos = XafterDirection(dir, curr, xdir);
                int      newBuildingZPos = ZafterDirection(dir, curr, xdir);
                Building newbuilding     = Instantiate(buildingPrefab);
                newbuilding.setPos(newBuildingXPos, newBuildingZPos);
                newbuilding.setSize(newBuildingSize, newBuildingSize);
                newbuilding.setSource(curr);
                newbuilding.transform.localPosition = new Vector3(newBuildingXPos, 0, newBuildingZPos);
                newbuilding.transform.SetParent(transform);
                occupyBuildingSpace(newBuildingXPos, newBuildingZPos, newBuildingSize, newbuilding);
                //print(curr.getEndLevel() + " is endlvl");
                newbuilding.setStartingLevel(curr.getEndLevel() + adjacentBuildingHeightDifference);
                newbuilding.generateMazeFloor(generateRandomXOpening(getOppositeDirection(dir), newBuildingSize), generateRandomZOpening(getOppositeDirection(dir), newBuildingSize), dir, curr.getEndLevel() + adjacentBuildingHeightDifference, new MazeUnit[newBuildingSize, newBuildingSize], newBuildingSize);
                buildingList.Add(newbuilding);
                findTallestBuilding.Add(newbuilding);
                finalBuildingList.Add(newbuilding);
            }
        }

        //place win spheres
        findTallestBuilding = getTallestBuildings(findTallestBuilding);
        //print(findTallestBuilding.Count + " is the tallest building count");

        for (int i = 0; i < findTallestBuilding.Count; i++)
        {
            Building b = findTallestBuilding[i];
            b.placeWin();
            if (i != 0)
            {
                totalWinDist += Vector3.Distance(findTallestBuilding[i - 1].getMyWinLocation(), findTallestBuilding[i].getMyWinLocation());
            }
        }
        tracebackGoalDistanceList(findTallestBuilding);
        print("TOTAL PATH LENGTH UP:: " + goalDistance + "   with " + findTallestBuilding.Count + " orbs to collect");
        InitGame.setWinReq(findTallestBuilding.Count, goalDistance);
    }
Ejemplo n.º 22
0
 // Use this for initialization
 void Start()
 {
     mainObj    = GameObject.Find("GameManager");
     mainScript = mainObj.GetComponent <InitGame>();
 }
Ejemplo n.º 23
0
 private void Start()
 {
     initObject = GameObject.Find("InitObject");
     initGame   = initObject.GetComponent <InitGame>();
 }
Ejemplo n.º 24
0
 void OnTriggerEnter(Collider other)
 {
     Destroy(gameObject);
     InitGame.winGame();
 }
Ejemplo n.º 25
0
 // Start is called before the first frame update
 void Start()
 {
     initGame = InitGame.GetComponent <InitGame>();
     StartCoroutine("ColumnCorrutine");
     CrearColumnaInicio();
 }
 private void SendDataInitToClient(Receiver client, InitGame data)
 {
     client.SendMessage(data);
 }
Ejemplo n.º 27
0
 void Start()
 {
     initGame = InitGame.GetComponent <InitGame>();
     StartCoroutine("ContadorPuntuacion");
 }
 // Start is called before the first frame update
 void Start()
 {
     initGame = InitGame.GetComponent <InitGame>();
     StartCoroutine("AsteroideCorrutine");
 }
Ejemplo n.º 29
0
        public void InitializeDlll(string path)
        {
            //TO DO FIX
            dllHandle = WindowsUtilities.LoadLibrary(Path.Combine(path, "HookCostume.dll"));
            if (dllHandle != null)
            {
                var initGameAddress = WindowsUtilities.GetProcAddress(dllHandle, "InitGame");
                if (initGameAddress != IntPtr.Zero)
                {
                    initGame = (InitGame)Marshal.GetDelegateForFunctionPointer(initGameAddress, typeof(InitGame));
                }

                var closeGameAddress = WindowsUtilities.GetProcAddress(dllHandle, "CloseGame");
                if (closeGameAddress != IntPtr.Zero)
                {
                    closeGame = (CloseGame)Marshal.GetDelegateForFunctionPointer(closeGameAddress, typeof(CloseGame));
                }

                var setUserHWndAddress = WindowsUtilities.GetProcAddress(dllHandle, "SetUserHWND");
                if (setUserHWndAddress != IntPtr.Zero)
                {
                    setUserHWnd =
                        (SetUserHWND)Marshal.GetDelegateForFunctionPointer(setUserHWndAddress, typeof(SetUserHWND));
                }

                var executeCmdAddress = WindowsUtilities.GetProcAddress(dllHandle, "ExecuteCommand");
                if (executeCmdAddress != IntPtr.Zero)
                {
                    executeCmd =
                        (ExecuteCommand)
                        Marshal.GetDelegateForFunctionPointer(executeCmdAddress, typeof(ExecuteCommand));
                }

                var getHoveredNPCInfoAddress = WindowsUtilities.GetProcAddress(dllHandle, "GetHoveredNPCInfo");
                if (getHoveredNPCInfoAddress != IntPtr.Zero)
                {
                    getHoveredNPCInfo =
                        (GetHoveredNPCInfo)
                        Marshal.GetDelegateForFunctionPointer(getHoveredNPCInfoAddress, typeof(GetHoveredNPCInfo));
                }

                var getMouseXYZInGameAddress = WindowsUtilities.GetProcAddress(dllHandle, "GetMouseXYZInGame");
                if (getMouseXYZInGameAddress != IntPtr.Zero)
                {
                    getMouseXYZInGame =
                        (GetMouseXYZInGame)
                        Marshal.GetDelegateForFunctionPointer(getMouseXYZInGameAddress, typeof(GetMouseXYZInGame));
                }

                var checkGameDoneAddress = WindowsUtilities.GetProcAddress(dllHandle, "CheckGameDone");
                if (checkGameDoneAddress != IntPtr.Zero)
                {
                    checkIfGameLoaded =
                        (CheckIfGameLoaded)
                        Marshal.GetDelegateForFunctionPointer(checkGameDoneAddress, typeof(CheckIfGameLoaded));
                }

                var detectCollisionAddress = WindowsUtilities.GetProcAddress(dllHandle, "CollisionDetection");
                if (checkGameDoneAddress != IntPtr.Zero)
                {
                    detectCollision =
                        (DetectCollision)
                        Marshal.GetDelegateForFunctionPointer(detectCollisionAddress, typeof(DetectCollision));
                }
            }
        }
Ejemplo n.º 30
0
 // Start is called before the first frame update
 void Start()
 {
     InitGame = GameObject.Find("InitGame");
     initGame = InitGame.GetComponent <InitGame>();
 }