Inheritance: MonoBehaviour
Example #1
0
    void UpdateCamera(bool allowPlayerControl)
    {
        float newCameraX = 0;
        float newCameraY = 0;

        if (allowPlayerControl)
        {
            newCameraX = gamepad.GetAxis(AxisCode.GamepadAxisRightX);
            newCameraY = -gamepad.GetAxis(AxisCode.GamepadAxisRightY);
        }
        //TODO: this should depend on delta time
        newCameraX = Mathf.Lerp(cameraX, GameFunctions.MapRange(newCameraX, 0, 1, 0, horizontalRange), .4f);
        newCameraY = Mathf.Lerp(cameraY, GameFunctions.MapRange(newCameraY, 0, 1, 0, verticalRange), .4f);

        camera.transform.RotateAround(transform.position, Vector3.up, newCameraX - cameraX);
        camera.transform.RotateAround(transform.position, camera.transform.right, newCameraY - cameraY);

        cameraX = newCameraX;
        cameraY = newCameraY;
    }
    private void OnCardMoved(MessageBase _msg, NetworkConnection _connection)
    {
        if (server.madeMoves < 1)
        {
            //convert message
            MoveCardMessage _moveCardMessgae = _msg as MoveCardMessage;
            //get the server player
            int playerIndex = server.players.IndexOf(server.players.Find(x => x.guid == _moveCardMessgae.playerGuid));
            //move the card on the server
            GameFunctions.MoveCard(server.players[playerIndex].GetZone(_moveCardMessgae.from_ZoneId), server.players[playerIndex].GetZone(_moveCardMessgae.to_ZoneId), _moveCardMessgae.cardGuid);
            //tell other players that the card has moved
            BroadcastMoveCardMessgae(server.players[playerIndex].guid, _moveCardMessgae.cardGuid, _moveCardMessgae.from_ZoneId, _moveCardMessgae.to_ZoneId);

            server.madeMoves++;
        }
        else
        {
            UnityEngine.Debug.Log(server.LogPrefix + "Illigal move detected");
        }
    }
Example #3
0
    protected WordsWithLetters GetWords(string[] keyChars)
    {
        List <string> wordsToUse   = new List <string>(10000);
        List <string> lettersToUse = new List <string>(10000);

        // Get the alphabetical lists
        for (int i = 97; i < 123; i++)
        {
            char     nextChar    = (char)i;
            string[] nextSubList = GameFunctions.GetTextJson(nextChar.ToString());
            // Recorring the list (nexSublist)
            for (int j = 0; j < nextSubList.Length; j++)
            {
                // Check with the key chars
                for (int k = 0; k < keyChars.Length; k++)
                {
                    if (nextSubList[j].Contains(keyChars[k]) || nextSubList[j].Contains(keyChars[k].ToLower()))
                    {
                        wordsToUse.Add(nextSubList[j]);
                        lettersToUse.Add(keyChars[k]);
                    }
                }
            }
        }

        // TODO: Añadir filtro de las palabras que puedan causar confusión
        //for(int i = 0; i < wordsToUse.Count; i++)
        //{
        //    for (int j = 1; j < wordsToUse.Count; j++)
        //    {

        //    }
        //}

        string[] preparedWords   = wordsToUse.ToArray();
        string[] preparedLetters = lettersToUse.ToArray();

        WordsWithLetters wordsWithLetters = new WordsWithLetters(preparedWords, preparedLetters);

        return(wordsWithLetters);
    }
Example #4
0
        public unsafe List <CAbilityPtr> GetAllAbilities()
        {
            List <CAbilityPtr> cabilityPtrList = new List <CAbilityPtr>();

            fixed(CUnitInternal *cunitInternalPtr = &this)
            {
                int    num1 = cunitInternalPtr->field01DC & cunitInternalPtr->field01E0;
                int *  a1   = &cunitInternalPtr->field01DC;
                IntPtr num2;

                if (num1 != -1 && (num2 = GameFunctions.sub_6F08AE90(a1)) != IntPtr.Zero)
                {
                    do
                    {
                        cabilityPtrList.Add(((CAbility *)(void *)num2)->AsSafe());
                        num2 = (*(int *)(void *)(num2 + 36) & *(int *)(void *)(num2 + 40)) == -1 ? IntPtr.Zero : GameFunctions.sub_6F08AE90((int *)(void *)(num2 + 36));
                    }while (num2 != IntPtr.Zero);
                }
            }

            return(cabilityPtrList);
        }
Example #5
0
        public static void SpotLight(Vector3 position, Vector3 direction, eLightFlags flags, float intensity, float range, float volumeIntensity, float volumeSize, float falloff, float innerAngle, float outerAngle, Color color, ulong shadowId = 0)
        {
            CLightDrawData *drawData = CLightDrawData.New(eLightType.SPOT_LIGHT, flags, position, color, intensity);
            NativeVector3   dir      = direction;
            NativeVector3   perp     = Utility.GetPerpendicular(dir).ToNormalized();

            drawData->Range = range;
            if (volumeIntensity > 0)
            {
                drawData->VolumeIntensity = volumeIntensity;
                drawData->VolumeExponent  = 70.0f;
                drawData->VolumeSize      = volumeSize;
            }
            drawData->FalloffExponent = falloff;
            GameFunctions.SetLightDrawDataDirection(drawData, &dir, &perp);
            GameFunctions.SetLightDrawDataAngles(drawData, innerAngle, outerAngle);
            if (shadowId != 0)
            {
                drawData->ShadowRenderId = shadowId;
                drawData->ShadowUnkValue = GameFunctions.GetValueForLightDrawDataShadowUnkValue(drawData);
            }
        }
Example #6
0
        public unsafe static void DumpFunctionToTrace(string name)
        {
            VirtualMachine *ptr  = *GameFunctions.GetThreadLocalStorage()->Jass.AsUnsafe()->VirtualMachine;
            HT_Node *       ptr2 = ptr->FunctionTable->Lookup(name);

            if (ptr2 != null)
            {
                OpCode *value = (OpCode *)ptr2->Value;
                string  text  = string.Empty;
                int     num   = -1;
                while (value[num].OpType != OpCodeType.EndFunction)
                {
                    text = $"{text}0x{num + 1:X4}{ByteCodeToString(value + num, "\t")}{Environment.NewLine}";
                    num++;
                }
                Trace.WriteLine(text);
                Trace.WriteLine($"Function '{name}'");
            }
            else
            {
                Trace.WriteLine($"Function '{name}' could not be found!");
            }
        }
Example #7
0
 // Sets the triggers for pressing the corresponding keys
 // Perhaps a good practice thing to do would be to create a "close scene" function that takes as parameter the answer and closes everything (including keysON=false) and then forwards to
 // changeToNextScene(answer) on game manager
 private void SetKeyInput()
 {
     if (GameManager.escena == "Trial")
     {
         if (Input.GetKeyDown(KeyCode.UpArrow)) //&& SubmissionValid(false))
         {
             InputOutputManager.SaveTimeStamp("ParticipantSkip");
             GameManager.ChangeToNextScene(itemClicks, true);
         }
     }
     else if (GameManager.escena == "SetUp")
     {
         if (Input.GetKeyDown(KeyCode.Space))
         {
             GameFunctions.SetTimeStamp();
             GameManager.ChangeToNextScene(itemClicks, false);
         }
     }
     else
     {
         Debug.Log("Skipped to next scene... I wonder why");
         GameManager.ChangeToNextScene(itemClicks, false);
     }
 }
Example #8
0
 private void timerUpdate_Tick(object sender, EventArgs e)
 {
     GameFunctions.Update();
 }
Example #9
0
        private void FormShips_VisibleChanged(object sender, EventArgs e)
        {
            if (this.Visible)
            {
                GameFunctions.LoadGame();
                int shipIndex = 0;

                this.panel01.Enabled = true;;
                this.panel02.Enabled = Globals.SaveAreasShipsCompleted[4, shipIndex];
                this.panel03.Enabled = Globals.SaveAreasShipsCompleted[4, ++shipIndex];
                this.panel04.Enabled = Globals.SaveAreasShipsCompleted[4, ++shipIndex];
                this.panel05.Enabled = Globals.SaveAreasShipsCompleted[4, ++shipIndex];
                this.panel06.Enabled = Globals.SaveAreasShipsCompleted[4, ++shipIndex];
                this.panel07.Enabled = Globals.SaveAreasShipsCompleted[4, ++shipIndex];
                this.panel08.Enabled = Globals.SaveAreasShipsCompleted[4, ++shipIndex];
                this.panel09.Enabled = Globals.SaveAreasShipsCompleted[4, ++shipIndex];

                bool shipX1Enabled = true;

                for (int i = 0; i < 5; i++)
                {
                    for (int j = 0; j < 5; j++)
                    {
                        if (!Globals.SaveAreasOreCollected[i, j])
                        {
                            shipX1Enabled = false;
                        }
                    }
                }

                this.panelX1.Enabled = shipX1Enabled;

                this.pictureBox01.Visible = this.panel01.Enabled;
                this.pictureBox02.Visible = this.panel02.Enabled;
                this.pictureBox03.Visible = this.panel03.Enabled;
                this.pictureBox04.Visible = this.panel04.Enabled;
                this.pictureBox05.Visible = this.panel05.Enabled;
                this.pictureBox06.Visible = this.panel06.Enabled;
                this.pictureBox07.Visible = this.panel07.Enabled;
                this.pictureBox08.Visible = this.panel08.Enabled;
                this.pictureBox09.Visible = this.panel09.Enabled;
                this.pictureBoxX1.Visible = this.panelX1.Enabled;

                if (!this.panel01.Enabled)
                {
                    this.panel01.BackgroundImage   = WinFormsLander.Properties.Resources.Locked;
                    this.labelID01.Visible         = this.panel01.Enabled;
                    this.labelName01.Visible       = this.panel01.Enabled;
                    this.labelFuel01.Visible       = this.panel01.Enabled;
                    this.labelResistance01.Visible = this.panel01.Enabled;
                    this.labelSpecial01.Visible    = this.panel01.Enabled;
                }

                if (!this.panel02.Enabled)
                {
                    this.panel02.BackgroundImage   = WinFormsLander.Properties.Resources.Locked;
                    this.labelID02.Visible         = this.panel02.Enabled;
                    this.labelName02.Visible       = this.panel02.Enabled;
                    this.labelFuel02.Visible       = this.panel02.Enabled;
                    this.labelResistance02.Visible = this.panel02.Enabled;
                    this.labelSpecial02.Visible    = this.panel02.Enabled;
                }

                if (!this.panel03.Enabled)
                {
                    this.panel03.BackgroundImage   = WinFormsLander.Properties.Resources.Locked;
                    this.labelID03.Visible         = this.panel03.Enabled;
                    this.labelName03.Visible       = this.panel03.Enabled;
                    this.labelFuel03.Visible       = this.panel03.Enabled;
                    this.labelResistance03.Visible = this.panel03.Enabled;
                    this.labelSpecial03.Visible    = this.panel03.Enabled;
                }

                if (!this.panel04.Enabled)
                {
                    this.panel04.BackgroundImage   = WinFormsLander.Properties.Resources.Locked;
                    this.labelID04.Visible         = this.panel04.Enabled;
                    this.labelName04.Visible       = this.panel04.Enabled;
                    this.labelFuel04.Visible       = this.panel04.Enabled;
                    this.labelResistance04.Visible = this.panel04.Enabled;
                    this.labelSpecial04.Visible    = this.panel04.Enabled;
                }

                if (!this.panel05.Enabled)
                {
                    this.panel05.BackgroundImage   = WinFormsLander.Properties.Resources.Locked;
                    this.labelID05.Visible         = this.panel05.Enabled;
                    this.labelName05.Visible       = this.panel05.Enabled;
                    this.labelFuel05.Visible       = this.panel05.Enabled;
                    this.labelResistance05.Visible = this.panel05.Enabled;
                    this.labelSpecial05.Visible    = this.panel05.Enabled;
                }

                if (!this.panel06.Enabled)
                {
                    this.panel06.BackgroundImage   = WinFormsLander.Properties.Resources.Locked;
                    this.labelID06.Visible         = this.panel06.Enabled;
                    this.labelName06.Visible       = this.panel06.Enabled;
                    this.labelFuel06.Visible       = this.panel06.Enabled;
                    this.labelResistance06.Visible = this.panel06.Enabled;
                    this.labelSpecial06.Visible    = this.panel06.Enabled;
                }

                if (!this.panel07.Enabled)
                {
                    this.panel07.BackgroundImage   = WinFormsLander.Properties.Resources.Locked;
                    this.labelID07.Visible         = this.panel07.Enabled;
                    this.labelName07.Visible       = this.panel07.Enabled;
                    this.labelFuel07.Visible       = this.panel07.Enabled;
                    this.labelResistance07.Visible = this.panel07.Enabled;
                    this.labelSpecial07.Visible    = this.panel07.Enabled;
                }

                if (!this.panel08.Enabled)
                {
                    this.panel08.BackgroundImage   = WinFormsLander.Properties.Resources.Locked;
                    this.labelID08.Visible         = this.panel08.Enabled;
                    this.labelName08.Visible       = this.panel08.Enabled;
                    this.labelFuel08.Visible       = this.panel08.Enabled;
                    this.labelResistance08.Visible = this.panel08.Enabled;
                    this.labelSpecial08.Visible    = this.panel08.Enabled;
                }

                if (!this.panel09.Enabled)
                {
                    this.panel09.BackgroundImage   = WinFormsLander.Properties.Resources.Locked;
                    this.labelID09.Visible         = this.panel09.Enabled;
                    this.labelName09.Visible       = this.panel09.Enabled;
                    this.labelFuel09.Visible       = this.panel09.Enabled;
                    this.labelResistance09.Visible = this.panel09.Enabled;
                    this.labelSpecial09.Visible    = this.panel09.Enabled;
                }

                if (!this.panelX1.Enabled)
                {
                    this.panelX1.BackgroundImage   = WinFormsLander.Properties.Resources.Locked;
                    this.labelIDX1.Visible         = this.panelX1.Enabled;
                    this.labelNameX1.Visible       = this.panelX1.Enabled;
                    this.labelFuelX1.Visible       = this.panelX1.Enabled;
                    this.labelResistanceX1.Visible = this.panelX1.Enabled;
                    this.labelSpecialX1.Visible    = this.panelX1.Enabled;
                }
            }
        }
Example #10
0
 public void VerifyInputs()
 {
     submitButton.interactable = GameFunctions.VerifyUsernameAndPassword(nameField.text, passwordField.text);
 }
Example #11
0
 void Awake()
 {
     gameFunctions = GetComponentInParent < GameFunctions > ();
     scoreTexts = GetComponentsInChildren<Text> ();
 }
Example #12
0
 public string ToString(IFormatProvider provider)
 {
     return(GameFunctions.JassStringHandleToString(GameFunctions.JassStringIndexToJassStringHandle(Reference)));
 }
Example #13
0
 public static int action_message(string msg)
 {
     GameFunctions.show_message(msg);
     return(0);
 }
Example #14
0
    void Update()        //called once per frame
    {
        if (GameFunctions.GetScore() == GameFunctions.GetNumOfDots())
        {
            GameFunctions.WinGame();
            EndGame();
        }

        if (GameFunctions.isGameOver())           //if game is over, allow player to press r to restart the scene

        {
            GameFunctions.ShowGUI();

            if (Input.GetKeyDown(KeyCode.R))
            {
                GameFunctions.StartGame();
            }
            return;
        }

        GameFunctions.SetGameTime(Time.timeSinceLevelLoad);

        if ((int)GameFunctions.GetGameTime() - (int)timeSinceFlip > timeToFlip)
        {
            timeSinceFlip = GameFunctions.GetGameTime();
            GameFunctions.FlipMoveMode();
        }
        if (Input.GetKeyDown(KeyCode.Alpha1))          //turn on debugging mode
        {
            GameFunctions.SetDebugging(true);
        }
        if (Input.GetKeyDown(KeyCode.Alpha2))          //turn off debugging mode
        {
            GameFunctions.SetDebugging(false);
        }
        if (Input.GetKeyDown(KeyCode.O))          //if the o key was pressed, show/hide GUI
        {
            GameFunctions.FlipGUI();
        }

        if (Input.anyKeyDown && !Input.GetKeyDown(KeyCode.Alpha1) && !Input.GetKeyDown(KeyCode.Alpha2) && !Input.GetKeyDown(KeyCode.O) && !Input.GetKeyDown(KeyCode.R)) //if an arrow key was pressed
        {
            moveX = Input.GetAxis("Horizontal");                                                                                                                        //check for horizontal input
            moveZ = Input.GetAxis("Vertical");                                                                                                                          //check for vertical input

            if (moveX > 0)                                                                                                                                              //if the player pressed the right arrow key, set desired direction to "right"
            {
                move = Directions.Right;
            }
            else if (moveX < 0)                 //if the player pressed the left arrow key, set desired direction to "left"
            {
                move = Directions.Left;
            }

            if (moveZ > 0)               //if the player pressed the up arrow key, set desired direction to "up"
            {
                move = Directions.Up;
            }
            else if (moveZ < 0)                  //if the player pressed the down arrow key, set desired direction to "down"
            {
                move = Directions.Down;
            }

            if (currentDirection == Directions.None)            //if theres no active tween, set moving direction to whatever was pressed
            {
                currentDirection = move;
                MoveToPositionDeadend();
            }
            else if (move != currentDirection)              //if theres an active tween but the direction is the opposite of current moving direction, start moving to opposite direction

            {
                if (MapUtility.OppositeDirection(move) == currentDirection)
                {
                    currentDirection = move;
                    MoveToPositionDeadend();
                }
                else                   //if new direction is perpendicular to current direction, move to nearest junction and start checking if player can move to the desired direction at that junction
                {
                    MoveToPositionJunction(MapUtility.getBackPoint(transform.gameObject, currentDirection));
                }
            }
        }
    }
Example #15
0
    // Saves the time stamp for a particular event type to the "TimeStamps" File
    // Event type: 1=ItemsNoQuestion; 11=ItemsWithQuestion; 2=AnswerScreen; 21=ParticipantsAnswer; 3=InterTrialScreen; 4=InterBlockScreen; 5=EndScreen
    public static void SaveTimeStamp(string eventType)
    {
        if (GameManager.problemName == 'w'.ToString())
        {
            string dataTrialText = GameManager.block + ";" + GameManager.trial + ";" + eventType + ";" + GameFunctions.TimeStamp();

            string[] lines = { dataTrialText };

            using (StreamWriter outputFile = new StreamWriter(folderPathSave + GetID() + "TimeStamps.txt", true))
            {
                WriteToFile(outputFile, lines);
            }
        }
        else if (GameManager.problemName == 't'.ToString() || GameManager.problemName == 'm'.ToString())
        {
            string dataTrialText = GameManager.block + ";" + GameManager.trial + ";" + eventType + ";" + GameFunctions.TimeStamp();

            string[] lines = { dataTrialText };

            using (StreamWriter outputFile = new StreamWriter(folderPathSave + GetID() + "TimeStamps.txt", true))
            {
                WriteToFile(outputFile, lines);
            }
        }
    }
Example #16
0
        private static void Main()
        {
            while (Game.IsLoading)
            {
                GameFiber.Sleep(500);
            }

            if (!Directory.Exists(@"Plugins\Spotlight Resources\"))
            {
                Directory.CreateDirectory(@"Plugins\Spotlight Resources\");
            }

            Settings = new Settings(@"Plugins\Spotlight Resources\General.ini",
                                    @"Plugins\Spotlight Resources\Offsets.ini",
                                    @"Plugins\Spotlight Resources\VisualSettings.xml",
                                    true);

            LoadSpotlightControllers();

            bool gameFnInit  = GameFunctions.Init();
            bool gameMemInit = GameMemory.Init();

            if (gameFnInit)
            {
                Game.LogTrivialDebug($"Successful {nameof(GameFunctions)} init");
            }
            if (gameMemInit)
            {
                Game.LogTrivialDebug($"Successful {nameof(GameMemory)} init");
            }

            if (!gameFnInit || !gameMemInit)
            {
                string str = "";
                if (!gameFnInit)
                {
                    str += nameof(GameFunctions);

                    if (!gameMemInit)
                    {
                        str += " and ";
                        str += nameof(GameMemory);
                    }
                }
                else if (!gameMemInit)
                {
                    str += nameof(GameMemory);
                }

                Game.DisplayNotification($"~r~[ERROR] Spotlight: ~s~Failed to initialize {str}, unloading...");
                Game.LogTrivial($"[ERROR] Failed to initialize {str}, unloading...");
                Game.UnloadActivePlugin();
            }

            BaseSpotlight.CoronaPositionPtr  = (NativeVector3 *)Game.AllocateMemory(sizeof(NativeVector3) * 2);
            BaseSpotlight.CoronaDirectionPtr = BaseSpotlight.CoronaPositionPtr++;

            // when the queue array that the GetFreeLightDrawDataSlotFromQueue function accesses is full,
            // it uses the TLS to get an allocator to allocate memory for a bigger array,
            // therefore we copy the allocator pointers from the main thread TLS to our current thread TLS.
            WinFunctions.CopyTlsValues(WinFunctions.GetProcessMainThreadId(), WinFunctions.GetCurrentThreadId(), GameMemory.TlsAllocatorOffset0, GameMemory.TlsAllocatorOffset1, GameMemory.TlsAllocatorOffset2);

            while (true)
            {
                GameFiber.Yield();

                Update();
            }
        }
Example #17
0
 public static CTriggerWar3Ptr FromHandle(JassTrigger trigger)
 {
     return(GameFunctions.GetTriggerFromHandle(trigger));
 }
Example #18
0
    /// <summary>
    /// Saves the time stamp for a particular event type to the "TimeStamps" File
    /// All these saves take place in the Data folder, where you can create an output folder
    /// </summary>
    /// Event type: 1=ItemsNoQuestion;11=ItemsWithQuestion;2=AnswerScreen;21=ParticipantsAnswer;3=InterTrialScreen;4=InterBlockScreen;5=EndScreen
    public static void saveTimeStamp(string eventType)
    {
        string dataTrialText = GameManager.block + ";" + GameManager.trial + ";" + eventType + ";" + GameFunctions.timeStamp();

        string[] lines          = { dataTrialText };
        string   folderPathSave = Application.dataPath + outputFolder;

        //This location can be used by unity to save a file if u open the game in any platform/computer:      Application.persistentDataPath;
        using (StreamWriter outputFile = new StreamWriter(folderPathSave + identifierName + "TimeStamps.txt", true))
        {
            foreach (string line in lines)
            {
                outputFile.WriteLine(line);
            }
        }
    }
Example #19
0
 public static CTriggerWar3 *FromHandle(JassTrigger trigger)
 {
     return(GameFunctions.GetTriggerFromHandle(trigger).AsUnsafe());
 }
        private static void Main()
        {
            while (Game.IsLoading)
            {
                GameFiber.Sleep(1000);
            }

            bool gameFnInit = GameFunctions.Init();

            if (gameFnInit)
            {
                Game.LogTrivialDebug($"Successful {nameof(GameFunctions)} init");
            }
            else
            {
                Game.LogTrivial($"[ERROR] Failed to initialize {nameof(GameFunctions)}, unloading...");
                Game.UnloadActivePlugin();
            }

            LoadVehicleConfigs();

            while (true)
            {
                GameFiber.Yield();

                if (Game.IsPaused)
                {
                    continue;
                }

                Vehicle playerVeh = Game.LocalPlayer.Character.CurrentVehicle;

                if (playerVeh && !vehiclesChecked.Contains(playerVeh.Handle))
                {
                    CreateGadgetsForVehicle(playerVeh);
                }

                for (int i = gadgets.Count - 1; i >= 0; i--)
                {
                    VehicleGadget g = gadgets[i];
                    if (g.Vehicle)
                    {
                        g.Update(g.Vehicle == playerVeh);
                        if (g.RequiresPoseBounds)
                        {
                            vehiclesRequiringPoseBounds.Add(g.Vehicle);
                        }
                    }
                    else
                    {
                        if (vehiclesChecked.Contains(g.Vehicle.Handle))
                        {
                            vehiclesChecked.Remove(g.Vehicle.Handle);
                        }
                        g.Dispose();
                        gadgets.RemoveAt(i);
                    }
                }


                foreach (Vehicle v in vehiclesRequiringPoseBounds)
                {
                    CVehicle *   cveh = (CVehicle *)v.MemoryAddress;
                    fragInstGta *inst = cveh->Inst;
                    if (inst == null)
                    {
                        return;
                    }

                    GameFunctions.fragInst_PoseBoundsFromSkeleton(inst, true, true, true, 0, 0);
                }
                vehiclesRequiringPoseBounds.Clear();
            }
        }
Example #21
0
 public static CItemPtr FromHandle(IntPtr itemJassHandle)
 {
     return(GameFunctions.GetItemFromHandle(itemJassHandle));
 }
Example #22
0
 public void WriteLine(String message, Color color, Single duration)
 {
     GameFunctions.CSimpleMessageFrame__WriteLine(this, message, ref color, duration, 0);
 }
Example #23
0
    void OnGUI()       //draw GUI (if it was set as visible)
    {
        if (GameFunctions.isGUIOn())
        {
            float posX, posY;
            GUI.skin.label.fontSize = 30;

            if (!GameFunctions.isGameOver())
            {
                posX = 50;
                posY = 50;

                GUI.Label(new Rect(posX, posY, 900, 200), "Score: " + GameFunctions.GetScore() + "\n" + GameFunctions.GetMoveMode());
            }
            else if (!GameFunctions.GetWinStatus())
            {
                posX = Screen.width / 2 - 190;
                posY = Screen.height / 2 - 150;

                GUI.Label(new Rect(posX, posY, 900, 200), "Game over, press r to restart \nYour score " + GameFunctions.GetScore());
            }
            else
            {
                posX = Screen.width / 2 - 190;
                posY = Screen.height / 2 - 150;

                GUI.Label(new Rect(posX, posY, 900, 200), "You won! Press r to restart.");
            }
        }
    }
Example #24
0
 public override string ToString() => GameFunctions.JassStringHandleToString(Handle);
Example #25
0
 public static int action_end_game()
 {
     GameFunctions.game_end();
     return(0);
 }
Example #26
0
 //Sets the triggers for pressing the corresponding keys
 //123: Perhaps a good practice thing to do would be to create a "close scene" function that takes as parameter the answer and closes everything (including keysON=false) and then forwards to
 //changeToNextScene(answer) on game manager
 //necessary: this was imported from decision version
 private void setKeyInput()
 {
     if (GameManager.escena == "Trial")
     {
         if (Input.GetKeyDown(KeyCode.UpArrow))
         {
             InputOutputManager.saveTimeStamp("ParticipantSkip");
             GameManager.changeToNextScene(itemClicks, 0, 0, 1);
         }
     }
     else if (GameManager.escena == "TrialAnswer")
     {
         //1: No/Yes 0: Yes/No
         if (randomYes == 1)
         {
             if (Input.GetKeyDown(KeyCode.LeftArrow))
             {
                 //Left
                 keysON = false;
                 answer = 0;
                 GameObject boto = GameObject.Find("LEFTbutton") as GameObject;
                 BoardFunctions.highlightButton(boto);
                 GameFunctions.setTimeStamp();
                 GameManager.changeToNextScene(itemClicks, 0, 1, 0);
             }
             else if (Input.GetKeyDown(KeyCode.RightArrow))
             {
                 //Right
                 keysON = false;
                 answer = 1;
                 GameObject boto = GameObject.Find("RIGHTbutton") as GameObject;
                 BoardFunctions.highlightButton(boto);
                 GameFunctions.setTimeStamp();
                 GameManager.changeToNextScene(itemClicks, 1, 1, 0);
             }
         }
         else if (randomYes == 0)
         {
             if (Input.GetKeyDown(KeyCode.LeftArrow))
             {
                 //Left
                 keysON = false;
                 answer = 1;
                 GameObject boto = GameObject.Find("LEFTbutton") as GameObject;
                 BoardFunctions.highlightButton(boto);
                 GameFunctions.setTimeStamp();
                 GameManager.changeToNextScene(itemClicks, 1, 0, 0);
             }
             else if (Input.GetKeyDown(KeyCode.RightArrow))
             {
                 //Right
                 keysON = false;
                 answer = 0;
                 GameObject boto = GameObject.Find("RIGHTbutton") as GameObject;
                 BoardFunctions.highlightButton(boto);
                 GameFunctions.setTimeStamp();
                 GameManager.changeToNextScene(itemClicks, 0, 0, 0);
             }
         }
     }
     else if (GameManager.escena == "SetUp")
     {
         if (Input.GetKeyDown(KeyCode.Space))
         {
             GameFunctions.setTimeStamp();
             GameManager.changeToNextScene(itemClicks, 0, 0, 0);
         }
     }
 }
Example #27
0
 public static unsafe CItem *FromHandle(IntPtr itemJassHandle)
 {
     return(GameFunctions.GetItemFromHandle(itemJassHandle).AsUnsafe());
 }
Example #28
0
 public void EndGame()
 {
     GameFunctions.EndGame();
     iTween.StopByName(id);
 }
 public static CDestructablePtr FromHandle(IntPtr destructableJassHandle)
 {
     return(GameFunctions.GetDestructableFromHandle(destructableJassHandle));
 }
Example #30
0
    //Initializes the scene. One scene is setup, other is trial, other is Break....
    void InitGame()
    {
        /*
         * Scene Order: escena
         * 0=setup
         * 1=trial game
         * 2=trial game answer
         * 3= intertrial rest
         * 4= interblock rest
         * 5= end
         */
        //Creates the variable scene? and selects the active scene
        Scene scene = SceneManager.GetActiveScene();

        escena = scene.name;
        //Name the scene "Scene #"
        Debug.Log("escena" + escena);
        //change numbers to names
        //the loop which runs the game, and drives you from one scene to another
        //If it's the first scene, upload parameters and instances (this happens only once), randomise instances and move incrememntally through >blocks< 1 at a time
        if (escena == "SetUp")
        {
            block++;
            //loadParameters ();
            //loadTSPInstance ();

            buttonRandomization = GameFunctions.randomizeButtons(numberOfTrials);
            GameFunctions.setupInitialScreen();
        }
        else if (escena == "Trial")
        {
            trial++;
            TotalTrial++;
            showTimer = true;
            boardScript.SetupScene("Trial");

            tiempo    = timeQuestion;
            totalTime = tiempo;
        }
        else if (escena == "TrialAnswer")
        {
            showTimer = true;
            boardScript.SetupScene("TrialAnswer");
            tiempo    = timeAnswer;
            totalTime = tiempo;
        }
        else if (escena == "InterTrialRest")
        {
            showTimer = false;
            tiempo    = timeRest1;
            totalTime = tiempo;
        }
        else if (escena == "InterBlockRest")
        {
            trial = 0;
            block++;
            showTimer = true;
            tiempo    = timeRest2;
            totalTime = tiempo;
            //Debug.Log ("TiempoRest=" + tiempo);

            buttonRandomization = GameFunctions.randomizeButtons(numberOfTrials);
        }
    }
Example #31
0
 public override string ToString()
 {
     return(GameFunctions.JassStringHandleToString(GameFunctions.JassStringIndexToJassStringHandle(Reference)));
 }