Inheritance: MonoBehaviour
コード例 #1
0
        public Multiplayer()
        {
            InitializeComponent();
            //For Keyboard
            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;

            _rawinput = new RawInput(Handle, true);

            _rawinput.AddMessageFilter();   // Adding a message filter will cause keypresses to be handled
            Win32.DeviceAudit();            // Writes a file DeviceAudit.txt to the current directory

            _rawinput.KeyPressed += OnKeyPressed;
            //Keyboard End

            wr = new WordsReader();
            Timelimit.Start();
            Gameflow.Start();
            NextLevel();

            /*
             * THREAD TEST
             *
             *
             */
        }
コード例 #2
0
ファイル: normalButton.cs プロジェクト: eloipuertas/ES2014B
    void Awake()
    {
        Time.timeScale = 1;
        Rect initPixelInset = new Rect(0, 0, 1, 1);

        initPixelInset.height = Screen.height * 0.10f;
        initPixelInset.width  = initPixelInset.height * 3f;
        initPixelInset.x      = Screen.width * 0.05f;
        initPixelInset.y      = -Screen.height * 0.475f;
        guiTexture.pixelInset = initPixelInset;
        color            = guiTexture.color;
        color.a          = 0;
        guiTexture.color = color;
        Gameflow.SetDifficulty(Gameflow.MEDIUM);
        // animation
        timeLeftAnimationChange = timeBetweenAnimationUnS;
        this.active             = true;
        animationIndex          = 0;
        timeLeftAnimationChange = timeBetweenAnimationS;
        currentAnimation        = texturesS;
        easyButton.noActive();
        hardButton.noActive();
        animationForward = true;
        animationIndex   = 0;
    }
コード例 #3
0
ファイル: TooltipHelper.cs プロジェクト: Chain-Reaction/NRaas
 public void OnGameSpeedChanged(Gameflow.GameSpeed newSpeed, bool locked)
 {
     if (newSpeed == Gameflow.GameSpeed.Pause)
     {
         sLastObjectId = 0;
         HideCurrentTooltip();
     }
 }
コード例 #4
0
 // Jump to item
 public void jump(GameObject targetGameFlowItem, bool goToNext = true)
 {
     Debug.Log("Gameflow: Jumping to " + targetGameFlowItem.name);
     curr_gameflow           = targetGameFlowItem.transform.parent.GetComponent <Gameflow>();
     curr_gameflow.curr_item = targetGameFlowItem.transform.GetSiblingIndex() - 1;
     if (goToNext)
     {
         next();
     }
 }
コード例 #5
0
    // Initialisations
    void Awake()
    {
        playerScores      = new int[4];
        playerDeathCounts = new int[4];
        playerColors      = new Color[4] {
            Color.grey, Color.grey, Color.grey, Color.grey
        };

        gameflow = GetComponent <Gameflow>();
    }
コード例 #6
0
 public void OnMouseEnter()
 {
     if (!Gameflow.IsDifficulty(Gameflow.EASY) && !Gameflow.IsDifficulty(Gameflow.MEDIUM) && !Gameflow.IsDifficulty(Gameflow.HARD))
     {
         Gameflow.SetDifficulty(Gameflow.MEDIUM);
     }
     selected                = true;
     animationIndex          = 0;
     timeLeftAnimationChange = timeBetweenAnimationS;
     currentAnimation        = texturesS;
 }
コード例 #7
0
 void Awake()
 {
     curr_gameflow = this;
     if (main == null)
     {
         main = this;
     }
     else
     {
         Destroy(this);
     }
 }
コード例 #8
0
ファイル: hardButton.cs プロジェクト: eloipuertas/ES2014B
    public void OnMouseUpAsButton()
    {
        audio.PlayOneShot(level_hard);
        this.active             = true;
        animationIndex          = 0;
        timeLeftAnimationChange = timeBetweenAnimationS;
        currentAnimation        = texturesS;

        easyButton.noActive();
        normalButton.noActive();
        // easy button NO active
        // normal button NO active

        Gameflow.SetDifficulty(Gameflow.HARD);
    }
コード例 #9
0
    // Go to next item
    public void next()
    {
        if (++(curr_gameflow.curr_item) >= curr_gameflow.transform.childCount) //Go back to last gameflow object if at the end of nested gameflow
        {
            Debug.Log("returning to gameflow: " + curr_gameflow.transform.parent.name);
            curr_gameflow = curr_gameflow.transform.parent.GetComponent <Gameflow>();
            if (curr_gameflow == null)
            {
                throw new System.NotImplementedException("Reached end of main gameflow: currently unhadled");
            }
            next();
            return;
        }
        GameflowItem item = curr_gameflow.transform.GetChild(curr_gameflow.curr_item).gameObject.GetComponent <GameflowItem>();

        if (item.gameObject.activeInHierarchy == false)           // Don't read disabled items
        {
            next();
            return;
        }
        if (item.GetType() == typeof(Dialogue))
        {
            Debug.Log("starting dialogue: " + item.name);
            player_ui.SetActive(false);
            //screenframe_vn.SetActive (true);
            //screenframe_battle.SetActive (false);
            BattleManagerS.main.setEnabled(false);
            DialogueManager.main.setEnabled(true);
            DialogueManager.main.startDialogue(curr_gameflow.transform.GetChild(curr_gameflow.curr_item).gameObject);
        }
        else if (item.GetType() == typeof(Battle))
        {
            Debug.Log("starting battle: " + item.name);
            player_ui.SetActive(true);
            //screenframe_vn.SetActive (false);
            //screenframe_battle.SetActive (true);
            DialogueManager.main.setEnabled(false);
            BattleManagerS.main.setEnabled(true);
            BattleManagerS.main.startBattle(curr_gameflow.transform.GetChild(curr_gameflow.curr_item).gameObject);
        }
        else if (item.GetType() == typeof(Gameflow))
        {
            Debug.Log("starting gameflow: " + item.name);
            curr_gameflow = (Gameflow)item;
            next();
        }
    }
コード例 #10
0
ファイル: CameraMovement.cs プロジェクト: eloipuertas/ES2014B
    void Update()
    {
        updatePlayerGo();
        if (playerGo == null)
        {
            return;
        }
        if (Gameflow.getPhase() == Gameflow.TROLL_FIGHT && timeout > 0)
        {
            timeout -= Time.deltaTime;
            if (!posSetejada)
            {
                dark        = true;
                posSetejada = true;
                Transform teranyina = GameObject.FindGameObjectWithTag("Door").transform;
                posCamera [0] = teranyina.position.x + 25;
                posCamera [1] = teranyina.position.y - 10;
                posCamera [2] = teranyina.position.z - maxZ;
                zInit         = teranyina.position.z;
                transform.LookAt(teranyina.position);
                transform.position = posCamera;
            }

            zInit += 1f;
            float z = Mathf.Min(zInit - maxZ, zInit);
            posCamera [2]      = z;
            transform.position = posCamera;
        }
        else
        {
            dark = false;
            if (Mathf.Abs(player.transform.position.x - firstMovement [0]) > 2 && Mathf.Abs(player.transform.position.z - firstMovement [2]) > 3)
            {
                Vector3 standardPos = player.position + relCameraPos;

                Vector3 abovePos = player.position + Vector3.up * relCameraPosMag;



                Vector3[] checkPoints = new Vector3[5];


                checkPoints [0] = standardPos;


                checkPoints [1] = Vector3.Lerp(standardPos, abovePos, 0.25f);
                checkPoints [2] = Vector3.Lerp(standardPos, abovePos, 0.5f);
                checkPoints [3] = Vector3.Lerp(standardPos, abovePos, 0.75f);


                checkPoints [4] = abovePos;

                if (player.position != anterior)
                {
                    anterior = player.position;
                    for (int i = 0; i < checkPoints.Length; i++)
                    {
                        ViewingPosCheck(checkPoints [i]);
                    }
                    ViewingPosCheck(transform.position);
                    bool enmig;
                    for (int j = 0; j < amagats.Count; j++)
                    {
                        enmig = changeAlpha(amagats [j]);
                        if (enmig)
                        {
                            amagats.Remove(amagats [j]);
                        }
                    }
                }


                distancia = Mathf.Clamp(distancia + -1 * Input.GetAxis("Mouse ScrollWheel") * zoomSpeed, distanciaMin, distanciaMax);


                posCamera [0] = player.position.x - distancia;
                posCamera [1] = player.position.y + distancia;
                posCamera [2] = player.position.z - distancia;

                transform.position = posCamera;

                transform.LookAt(player.position);
            }
        }
    }
コード例 #11
0
ファイル: Engine.cs プロジェクト: RedTheKitsune/NFSWGameplay
 // Token: 0x060016D8 RID: 5848 RVA: 0x00027EEE File Offset: 0x00026EEE
 public void Ready()
 {
     this.manager.Ready();
     this.gameflow = WorkflowInstance.Create(Gameflow.Create(this.manager));
     this.gameflow.Start();
 }
コード例 #12
0
ファイル: HUD.cs プロジェクト: eloipuertas/ES2014B
    void OnGUI()
    {
        GameObject go = GameObject.FindGameObjectWithTag("Player");

        if (go != null)
        {
            pj     = go.GetComponent("MainPjMovement") as MainPjMovement;
            player = go.GetComponent("Player") as Player;
        }

        if (pj == null)
        {
            return;
        }

        Time.timeScale = 1;
        amplada        = Screen.width / 10;
        altura         = Screen.height / 8;
        xPos           = Screen.width / 2.7f;
        yPos           = Screen.height / 3.2f;

        GUI.skin = myskin;

        buttonSizeHeight = Screen.height / 15;
        buttonSizeWidth  = Screen.width / 5;
        float maxVida, maxMana;

        vida           = pj.getHP();
        mana           = pj.getMP();
        magiaEscollida = pj.getSelectedSpell() + 1;
        maxVida        = pj.getMAXHP();
        maxMana        = pj.getMAXMP();



        vidapercent = vida / maxVida;


        if (vidapercent < 0)
        {
            vidapercent = 0;
        }
        if (vidapercent > 100)
        {
            vidapercent = 100;
        }

        alturaVida = vidapercent * altura;

        manapercent = mana / maxMana;

        if (manapercent < 0)
        {
            manapercent = 0;
        }
        if (manapercent > 100)
        {
            manapercent = 100;
        }

        alturaMana = manapercent * altura;

        float xVida     = Screen.width * 0.31f;
        float xBG       = Screen.width * 0.25f;
        float yVida     = Screen.height - alturaVida;
        float yMana     = Screen.height - alturaMana;
        float ampladaBG = Screen.width / 2;
        //float xMana = Screen.width - Screen.width * 2 / 10;
        float xMana       = xBG + ampladaBG - amplada - Screen.width * 0.06f;
        float xActual     = xVida + amplada;
        float alturaMagia = Screen.height / 15;
        float yMagies     = Screen.height - alturaMagia - Screen.height * 0.01f;


        int numTextures = 3;


        if (vida < maxVida * bloodTantPerCentVida && pj.isAlive())
        {
            //Vector4 alpha = new Vector4 (1, 0, 0, 1 - vida / maxVida);
            Vector4 alpha    = new Vector4(1, 0, 0, alphaValue);
            Color   original = GUI.color;
            GUI.color = alpha;
            GUI.DrawTexture(new Rect(0, 0, Screen.width, Screen.height), bloodTexture);
            GUI.color    = original;
            pintadatime -= Time.deltaTime;

            float timeScale = Time.timeScale;
            Time.timeScale = 1;
            //print ("incrementar " + incrementar + ", " + Time.deltaTime);
            if (incrementar)
            {
                alphaValue += Time.deltaTime * 0.4f;
                if (alphaValue >= maxAlpha)
                {
                    incrementar = false;
                }
            }
            else
            {
                alphaValue -= Time.deltaTime * 0.4f;
                if (alphaValue <= minAlpha)
                {
                    incrementar = true;
                }
            }
            Time.timeScale = timeScale;



            /*if (pintadatime < 0f && incrementar) {
             *              pintadatime = tempsPintada;
             *
             *              alphaValue += 0.1f;
             *              if (alphaValue >= maxAlpha) {
             *                              incrementar = false;
             *              }
             * } else if (pintadatime < 0f && !incrementar) {
             *              alphaValue -= 0.1f;
             *              if (alphaValue < minAlpha) {
             *                              incrementar = true;
             *
             *              }
             * }*/
        }
        GUI.DrawTexture(new Rect(xBG, Screen.height - Screen.height / 5, ampladaBG, Screen.height / 5), this.hud_bg);
        for (int i = 0; i < numTextures; i++)
        {
            if (i == 0)                                      //vida

            {
                GUI.BeginGroup(new Rect(xVida, yVida, amplada, Screen.height - yVida));
                GUI.DrawTexture(new Rect(0, alturaVida - altura, altura, altura), this.texVida);
                //GUI.DrawTexture (new Rect (0, alturaVida - altura, amplada, altura), this.vidaCover);
                GUI.EndGroup();
                GUI.BeginGroup(new Rect(xVida, Screen.height - altura, amplada, Screen.height - altura));
                GUI.DrawTexture(new Rect(0, 0, altura, altura), this.vidaCover);
                GUI.EndGroup();
            }
            else if (i == numTextures - 1)                                        //mana
            //GUI.BeginGroup (new Rect (xMana, yMana, amplada, Screen.height - yMana));

            {
                GUI.BeginGroup(new Rect(xMana, yMana, amplada, Screen.height - yMana));
                GUI.DrawTexture(new Rect(Mathf.Abs(altura - amplada), alturaMana - altura, altura, altura), this.texMana);
                //GUI.DrawTexture (new Rect (0, alturaMana - altura, amplada, altura), this.manaCover);
                GUI.EndGroup();
                GUI.BeginGroup(new Rect(xMana, Screen.height - altura, amplada, Screen.height - altura));
                GUI.DrawTexture(new Rect(Mathf.Abs(altura - amplada), 0, altura, altura), this.manaCover);
                GUI.EndGroup();
            }
            else                                        //altres
            {
                Texture texturaMagia = magiaEscollida == i ? magiaNormal : magiaSelect;
                GUI.DrawTexture(new Rect(xActual, yMagies, alturaMagia, alturaMagia), texturaMagia);
            }


            xActual += alturaMagia;
        }
        if (pj.getShield())                         //descomentar a devel
        {
            GUI.DrawTexture(new Rect(xMana - alturaMagia - Screen.width * 0.01f, yMagies, alturaMagia, alturaMagia), texEscut);
        }



        if (player.canShowMenuPause() && pj.isAlive() && Gameflow.getPhase() != Gameflow.GAME_COMPLETE)
        {
            Time.timeScale = 0;
            GUI.DrawTexture(new Rect(xPos - Screen.width * 0.12f, yPos - Screen.height * 0.3f, Screen.width * 0.45f, Screen.height * 0.25f), this.titolPausa);
            GUI.DrawTexture(new Rect(xPos - Screen.width * 0.05f, Screen.height * 0.32f, Screen.width * 0.3f, Screen.height * 0.25f), this.fonsMenuPausa);
            Rect pauseRect = new Rect(xPos, yPos, buttonSizeWidth, buttonSizeHeight);

            continueTexture = pauseRect.Contains(Event.current.mousePosition) ? this.continueTextureSelected : this.continueTextureNormal;

            if (GUI.Button(pauseRect, continueTexture))
            {
                player.hideMenuPause();
            }
            Rect audioRect = new Rect(xPos, buttonSizeHeight + yPos, buttonSizeWidth, buttonSizeHeight);
            if (sona)                                      //pausar audio
            {
                audioTexture = audioRect.Contains(Event.current.mousePosition) ? this.audioOFFSelected : this.audioOFFNormal;
            }
            else                                        //reproduir audio
            {
                audioTexture = audioRect.Contains(Event.current.mousePosition) ? this.audioONSelected : this.audioONNormal;
            }
            if (GUI.Button(audioRect, audioTexture))
            {
                if (sona)                                                  //pausar audio
                {
                    AmbientAudio.PauseAudio();
                }
                else                                                    //reproduir audio
                {
                    AmbientAudio.UnPauseAudio();
                }
                sona = !sona;
            }
            Rect restart = new Rect(xPos, 2 * buttonSizeHeight + yPos, buttonSizeWidth, buttonSizeHeight);
            restartTexture = restart.Contains(Event.current.mousePosition) ? this.restartTextureSelected : this.restartTextureNormal;
            if (GUI.Button(restart, restartTexture))
            {
                Object.Destroy(GameObject.FindGameObjectWithTag("Player"));
                Application.LoadLevel(Application.loadedLevel);
            }
            Rect returnPause = new Rect(xPos, 3 * buttonSizeHeight + yPos, buttonSizeWidth, buttonSizeHeight);
            backMainMenuTexture = returnPause.Contains(Event.current.mousePosition) ? this.backMainMenuTextureSelected : this.backMainMenuTextureNormal;
            if (GUI.Button(returnPause, backMainMenuTexture))
            {
                Object.Destroy(GameObject.FindGameObjectWithTag("Player"));
                Application.LoadLevel(0);
            }
        }

        if (!pj.isAlive())
        {
            timeLeft -= Time.deltaTime;
            if (timeLeft < 0)
            {
                AmbientAudio.PlayGameOver();
                GUI.DrawTexture(new Rect(Screen.width * 0.5f - Screen.width * 0.2f, 0, Screen.width * 0.4f, Screen.height * 0.4f), gameOverTexture);
                GUI.DrawTexture(new Rect(xPos + Screen.width * 0.01f, Screen.height * 0.4f, Screen.width * 0.2f, Screen.height * 0.27f), this.fonsMenuGameover);
                Time.timeScale = 0;
                Rect restart = new Rect(xPos + Screen.width * 0.01f, Screen.height * 0.4f, Screen.width * 0.2f, Screen.height * 0.1f);
                restartTexture = restart.Contains(Event.current.mousePosition) ? this.restartTextureSelected : this.restartTextureNormal;
                if (GUI.Button(restart, restartTexture))
                {
                    Object.Destroy(GameObject.FindGameObjectWithTag("Player"));
                    Application.LoadLevel(Application.loadedLevel);
                }
                Rect returnOver = new Rect(xPos + Screen.width * 0.01f, Screen.height * 0.5f, Screen.width * 0.2f, Screen.height * 0.2f);
                backMainMenuTexture = returnOver.Contains(Event.current.mousePosition) ? this.backMainMenuTextureSelected : this.backMainMenuTextureNormal;


                if (GUI.Button(returnOver, backMainMenuTexture))
                {
                    Object.Destroy(GameObject.FindGameObjectWithTag("Player"));
                    Application.LoadLevel(0);
                }
            }
        }

        if (win_message_enabled)
        {
            if (!endMusicEnabled)
            {
                AmbientAudio.PlayCredits();
                endMusicEnabled = true;
            }

            GUI.DrawTexture(new Rect(Screen.width * 0.5f - Screen.width * 0.2f, 0, Screen.width * 0.4f, Screen.height * 0.4f), winTexture);
            GUI.DrawTexture(new Rect(xPos + Screen.width * 0.01f, Screen.height * 0.4f, Screen.width * 0.2f, Screen.height * 0.27f), this.fonsMenuGameover);
            Time.timeScale = 0;
            Rect restart = new Rect(xPos + Screen.width * 0.01f, Screen.height * 0.4f, Screen.width * 0.2f, Screen.height * 0.1f);
            restartTexture = restart.Contains(Event.current.mousePosition) ? this.restartTextureSelected : this.restartTextureNormal;
            if (GUI.Button(restart, restartTexture))
            {
                Object.Destroy(GameObject.FindGameObjectWithTag("Player"));
                Application.LoadLevel(Application.loadedLevel);
            }
            Rect returnOver = new Rect(xPos + Screen.width * 0.01f, Screen.height * 0.5f, Screen.width * 0.2f, Screen.height * 0.2f);
            backMainMenuTexture = returnOver.Contains(Event.current.mousePosition) ? this.backMainMenuTextureSelected : this.backMainMenuTextureNormal;


            if (GUI.Button(returnOver, backMainMenuTexture))
            {
                Object.Destroy(GameObject.FindGameObjectWithTag("Player"));
                Application.LoadLevel(0);
            }
        }
    }
コード例 #13
0
ファイル: MapHandler.cs プロジェクト: McGameJam/LikeASir
 public void PlayerWins(PlayerController player)
 {
     Gameflow.GameWon(player);
 }
コード例 #14
0
        static void Main(string[] args)
        {
            Settings.SetSettings();

            Gameflow.Run();
        }