Inheritance: MonoBehaviour
コード例 #1
0
    void Update()
    {
        if (activated && Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Began)
        {
            if (!GamePause.isPaused() && isExtraWindowsDisabled())
            {
                touchPos = Camera.main.ScreenToWorldPoint(Input.GetTouch(0).position);

                if (toRotate())
                {
                    blocks.getBlock().GetComponent <Block>().rotate();
                }
                else if (toMoveDown())
                {
                    blocks.getBlock().GetComponent <Block>().speedUp = true;
                }
                else if (toTurnLeft())
                {
                    blocks.getBlock().GetComponent <Block>().turnLeft();
                }
                else
                {
                    blocks.getBlock().GetComponent <Block>().turnRight();
                }
            }
            else
            {
                GamePause.deactivateAnimated();
            }
        }
    }
コード例 #2
0
ファイル: blocksManager.cs プロジェクト: mengtest/Tetris-1
 void Update()
 {
     if (!GamePause.isPaused() && transform.childCount == 0)
     {
         pushBlock();
     }
 }
コード例 #3
0
    // Update is called once per frame
    void Update()
    {
        if (GamePause.IsPaused())
        {
            return;
        }


        if (!target == null)
        {
            gameObject.SetActive(false);
        }

        //Mainly for the rocket but, this rotate the bullet as well...
        Vector3 displacement = target.transform.position - transform.position;

        target.transform.rotation = Quaternion.LookRotation(new Vector3(displacement.x, 0, displacement.z));

        Vector3 distanceRemaining = target.transform.position - transform.position;
        float   distanceTraveled  = speed * Time.deltaTime;

        if (distanceRemaining.magnitude > distanceTraveled)
        {
            transform.position += distanceRemaining.normalized * distanceTraveled;
        }
        else
        {
            Hit(target);
        }
    }
コード例 #4
0
        public void PlayPauseSound()
        {
            if (GameStateMachine.Instance.GameState.ToString() == "SuperMario.GameStates.PausedState")
            {
                if (OverWorldInstance.State == SoundState.Playing)
                {
                    OverWorldInstance.Pause();
                }

                else if (UndergroundInstance.State == SoundState.Playing)
                {
                    UndergroundInstance.Pause();
                }

                else if (StarInstance.State == SoundState.Playing)
                {
                    StarInstance.Pause();
                }

                else if (TimeRunningOutOverworldInstance.State == SoundState.Playing)
                {
                    TimeRunningOutOverworldInstance.Pause();
                }

                else if (TimeRunningOutStarInstance.State == SoundState.Playing)
                {
                    TimeRunningOutStarInstance.Pause();
                }
            }

            else if (GameStateMachine.Instance.GameState.ToString() == "SuperMario.GameStates.PlayingState")
            {
                if (OverWorldInstance.State == SoundState.Paused)
                {
                    OverWorldInstance.Resume();
                }

                else if (UndergroundInstance.State == SoundState.Paused)
                {
                    UndergroundInstance.Resume();
                }

                else if (StarInstance.State == SoundState.Paused)
                {
                    StarInstance.Resume();
                }

                else if (TimeRunningOutOverworldInstance.State == SoundState.Paused)
                {
                    TimeRunningOutOverworldInstance.Resume();
                }

                else if (TimeRunningOutStarInstance.State == SoundState.Paused)
                {
                    TimeRunningOutStarInstance.Resume();
                }
            }

            GamePause.Play();
        }
コード例 #5
0
ファイル: DialogSystem.cs プロジェクト: wmleungab/UST-Escape
    public void onChildrenTouched(string name)
    {
        switch (name)
        {
        case "yesBtn":
            Debug.Log("Yes clicked");
            gameObject.audio.Play();
            playerOption = true;
            break;

        case "noBtn":
            Debug.Log("No clicked");
            gameObject.audio.Play();
            playerOption = false;
            break;
        }



        Destroy(dialogInstance);
        onFinish();
        dialogisOn = false;
        occupied   = false;
        GamePause.continueGame();
    }
コード例 #6
0
    void Start()
    {
        if ((mTesting && !Application.isEditor))
        {
            GameObject.Destroy(this.gameObject);
            Debug.Log("Destroyed Test Game Instance");
            return;
        }

        if (mInstance != null && mInstance != this)
        {
            GameObject.Destroy(this);
            return;
        }

        mInstance = this;
        DontDestroyOnLoad(this);

        InitLogicImplementation();
        gameLogicImplementation.Start();

        mGameLicense = Helpers.CreateComponentIfNotExists <GameLicense>(this);
        mGameOptions = Helpers.CreateComponentIfNotExists <GameOptions>(this);
        mGameState   = Helpers.CreateComponentIfNotExists <GameStateManager>(this);
        mGamePlayer  = Helpers.CreateComponentIfNotExists <GamePlayer>(this);
        mGameMusic   = Helpers.CreateComponentIfNotExists <GameMusic>(this);
        mGameLoca    = Helpers.CreateComponentIfNotExists <GameLocalization>(this);
        mGameLoca.Initialize();
        mGamePause       = Helpers.CreateComponentIfNotExists <GamePause>(this);
        mGameInput       = Helpers.CreateComponentIfNotExists <GameInput>(this);
        mSceneTransition = Helpers.CreateComponentIfNotExists <SceneTransition>(this);
        mGameData        = Helpers.CreateComponentIfNotExists <GameData>(this);

        mFirstFrame = true;
    }
コード例 #7
0
ファイル: Block.cs プロジェクト: mengtest/Tetris-1
 void Update()
 {
     if (!GamePause.isPaused())
     {
         if (detector.canMoveVertical(actitveRotation))
         {
             if (timer <= 0)
             {
                 moveTilesVertical();
                 if (!speedUp)
                 {
                     timer = fallTimer;
                 }
                 else
                 {
                     timer = fallTimer / moveDownMultiplier;
                 }
             }
             else
             {
                 timer -= Time.deltaTime;
             }
         }
         else
         {
             managerBlocks.pushBlock();
             destroy();
         }
     }
 }
コード例 #8
0
ファイル: SundialDialog.cs プロジェクト: wmleungab/UST-Escape
    // Use this for initialization
    void Start()
    {
        GamePause.pauseGame();

        name.GetComponent <TextMesh> ().text     = "You";
        dialogue.GetComponent <TextMesh> ().text = main1;
    }
コード例 #9
0
ファイル: Settings.cs プロジェクト: mengtest/Tetris-1
 public void activate()
 {
     gameObject.SetActive(true);
     GamePause.activate();
     anim.Play("SettingsDisplay");
     updateCheckmarks();
 }
コード例 #10
0
    // Use this for initialization
    void Start()
    {
        GamePause.pauseGame();
        DialogSystem.character[] cArr =
        {
            DialogSystem.character.VOLDEMORT,
            DialogSystem.character.PLAYER,
            DialogSystem.character.VOLDEMORT,
            DialogSystem.character.PLAYER,
            DialogSystem.character.VOLDEMORT,
            DialogSystem.character.PLAYER,
            DialogSystem.character.VOLDEMORT,
            DialogSystem.character.VOLDEMORT,
            DialogSystem.character.PLAYER,
            DialogSystem.character.VOLDEMORT,
            DialogSystem.character.VOLDEMORT
        };

        string[] dialog = new string[] {
            "Finally, get you back to here...",
            "Oh, I am sorry, does it hurt?",
            "I am fine... Just feel sleepy...",
            "Why did you attack me?!",
            "I was controlled by the boss... That was not what I want",
            "Your boss? Who he is? Take me to him!",
            "I can't hold long... listen!",
            "Use my magic ward to unlock the sundial, he is under there!",
            "Magic? Who are you?\nHow can you know magic?",
            "I was the magic club chairman long time ago...",
            "Remember Mobiliarbus...Mobiliarbus..."
        };

        conversation(cArr, dialog, 1);
    }
コード例 #11
0
    protected override void OnUpdate()
    {
        Entities
        .WithoutBurst()
        .WithStructuralChanges()
        .ForEach((Entity entity, SpriteRenderer renderer, ref HitComponent hitComp, ref AnimationFrameComponent animComp) => {
            if (false == AnimUtility.HasState(animComp, AnimUtility.hit))
            {
                animComp.state |= AnimUtility.hit;
                renderer.color  = hitComp.hitEffectColor;
                GamePause.Pause(0.15f);
            }

            hitComp.elapsedTime += Time.DeltaTime;
            if ((hitComp.elapsedTime >= hitComp.hitEffectTime) && (renderer.color == hitComp.hitEffectColor))
            {
                renderer.color = Color.white;
            }
            else if (hitComp.elapsedTime >= hitComp.godTime)
            {
                animComp.state ^= AnimUtility.hit;
                EntityManager.RemoveComponent <HitComponent>(entity);
                EntityManager.RemoveComponent <MoveComponent>(entity);
            }
        }).Run();
    }
コード例 #12
0
ファイル: InputManager.cs プロジェクト: MrHungerrr/Qmobi_Test
    public InputManager()
    {
        _controls = new PlayerInput();

        #region Game
        _controls.Game.Movement.started   += ctx => ShipMove.Invoke(true);
        _controls.Game.Movement.canceled  += ctx => ShipMove.Invoke(false);
        _controls.Game.Rotation.performed += ctx => ShipRotate.Invoke(ctx.ReadValue <float>());
        _controls.Game.Rotation.canceled  += ctx => ShipRotate.Invoke(0);
        _controls.Game.Fire.started       += ctx => ShipFire.Invoke(true);
        _controls.Game.Fire.canceled      += ctx => ShipFire.Invoke(false);
        _controls.Game.Pause.started      += ctx => GamePause.Invoke();
        _controls.Game.Restart.started    += ctx => GameRestart.Invoke();
        #endregion

        #region Pause
        _controls.Pause.Exit.started   += ctx => PauseExit.Invoke();
        _controls.Pause.Resume.started += ctx => PauseResume.Invoke();
        #endregion

        #region Game Over
        _controls.GameOver.Restart.started += ctx => GameOverRestart.Invoke();
        _controls.GameOver.Exit.started    += ctx => GameOverExit.Invoke();
        #endregion

        GameManager.Instance.OnGameStateChanged += SwitchInputType;
    }
コード例 #13
0
 public void activate(int points)
 {
     gameObject.SetActive(true);
     GamePause.activate();
     pointsValue.text = points.ToString();
     anim.Play("EndGameDisplay");
 }
コード例 #14
0
 // Use this for initialization
 void Start()
 {
     player          = GameObject.Find("Player");
     healthText      = GetComponentInChildren <Text>();
     healthText.text = "";
     MovableChars    = GameObject.Find("MovableCharacters");
     pause           = MovableChars.GetComponent <GamePause> ();
 }
コード例 #15
0
 virtual public void colliderOnClick()
 {
     if (!GamePause.isPause() && (Mathf.Abs(Vector3.Distance(playerObj.transform.position, transform.position)) < maxTouchingDistance))
     {
         Debug.Log("collider Clicked (Event)");
         startFindKey(keyItemName);
     }
 }
コード例 #16
0
 private void Awake()
 {
     boxCollider  = GetComponent <BoxCollider>();
     anim         = selector.GetComponent <Animator>();
     topieMachine = FindObjectOfType <TopieMachine>();
     pause        = FindObjectOfType <GamePause>();
     canDrag      = true;
 }
コード例 #17
0
 public void buttonStartGame()
 {
     blockCreator.buttonBack();
     game.SetActive(true);
     GamePause.activate();
     game.GetComponent <Game>().newGame();
     gameObject.SetActive(false);
 }
コード例 #18
0
 protected override void OnShow()
 {
     base.OnShow();
     _bind.Menu.Enable = true;
     //Sound.PlayUiAudioOneShot(1004);
     Sound.PauseMusic();
     GamePause.PauseGame(EPauseFrom.Esc);
 }
コード例 #19
0
ファイル: tableCollider.cs プロジェクト: wmleungab/UST-Escape
 void OnMouseDown()
 {
     if (!GamePause.isPause())
     {
         Debug.Log("collider clicked");
     }
     transform.parent.gameObject.SendMessage("colliderOnClick");
 }
コード例 #20
0
 private void Awake()
 {
     coneMachine   = FindObjectOfType <ConeMachine>();
     pause         = FindObjectOfType <GamePause>();
     anim          = GetComponent <Animator>();
     boxCollider   = GetComponent <BoxCollider>();
     canDrag       = true;
     isExitColider = false;
 }
コード例 #21
0
    private Vector2 direction;     // Will be used to get the direction the player is facing for range attacks or other purposes.

    // Use this for initialization
    void Start()
    {
        pause = GetComponentInParent <GamePause> ();
        rbody = GetComponent <Rigidbody2D> ();
        anim  = GetComponent <Animator> ();
        anim.SetBool("isWalking", false);     // Player start at idle
        direction = new Vector2(0, 1);        // Players starting direction

        playerTransform = GetComponent <Transform>();
    }
コード例 #22
0
 //Start Method
 private void Start()
 {
     bombController      = this.GetComponent <BombController>();
     enemiesController   = this.GetComponent <EnemiesController>();
     timeController      = this.GetComponent <TimeController>();
     scoreController     = this.GetComponent <ScoreController>();
     sceneController     = this.GetComponent <SceneController>();
     extraEggsController = this.GetComponent <ExtraEggsController>();
     gamePauseController = this.GetComponent <GamePause>();
 }
コード例 #23
0
 override public void  onDialogFinish(int id, int selection)
 {
     //selection -1: No selection carried out 0; false or no 1: true or yes
     Debug.Log("Dialog with id " + id + "has finished with selection result " + selection);
     if (id == 732)
     {
         GamePause.pauseGame();
         AutoFade.LoadLevel("end_scene", 1f, 1f, Color.black);
     }
 }
コード例 #24
0
 void OnApplicationPause(bool status)
 {
     if (status)
     {
         Broker.Global.Publish(GamePause.Get());
     }
     else
     {
         Broker.Global.Publish(GameResume.Get());
     }
 }
コード例 #25
0
    // Start is called before the first frame update
    void Start()
    {
        snakeScoredDel += SpawnApple;
        gameOverDel    += KillSnake;
        gamePausedDel  += PauseGame;

        InitialiseGameState();

        SpawnApple();
        SpawnSnake();
    }
コード例 #26
0
 public void rotate()
 {
     if (!GamePause.isPaused() && !endgame.isActive())
     {
         blocks.getBlock().GetComponent <Block>().rotate();
     }
     else if (GamePause.isPaused() && !endgame.isActive())
     {
         GamePause.deactivateAnimated();
     }
 }
コード例 #27
0
 public void moveDown()
 {
     if (!GamePause.isPaused() && !endgame.isActive())
     {
         blocks.getBlock().GetComponent <Block>().speedUp = true;
     }
     else if (GamePause.isPaused() && !endgame.isActive())
     {
         GamePause.deactivateAnimated();
     }
 }
コード例 #28
0
 private void Awake()
 {
     candyMachine    = FindObjectOfType <CandyMachine>();
     popMachine      = FindObjectOfType <PopPopMachine>();
     sprinkleMachine = FindObjectOfType <SprinkleMachine>();
     topieMachine    = FindObjectOfType <TopieMachine>();
     coneMachine     = FindObjectOfType <ConeMachine>();
     audioSource     = GetComponent <AudioSource>();
     gameController  = FindObjectOfType <GameController>();
     pause           = FindObjectOfType <GamePause>();
     trash           = FindObjectOfType <Trash>();
 }
コード例 #29
0
    IEnumerator PauseCoroutine()
    {
        GamePause gamePause = canvas.GetComponent <GamePause>();

        gamePause.Pause();
        narratorTrigger.Play();
        Debug.Log(narratorTrigger.GetLength());
        yield return(new WaitForSecondsRealtime(narratorTrigger.GetLength()));

        gamePause.Resume();
        SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex + 1);
    }
コード例 #30
0
ファイル: StopNavMesh.cs プロジェクト: wmleungab/UST-Escape
 void Update()
 {
     if (GamePause.isPause() && !isPause)
     {
         isPause = true;
         stopWalking();
     }
     else if (!GamePause.isPause() && isPause)
     {
         isPause = false;
         resumeWalking();
     }
 }
コード例 #31
0
ファイル: GamePause.cs プロジェクト: RandomNPC/Mathius_DOE
 void Awake()
 {
     gameDisabled = false;
     gameEnd = false;
     PAUSE = gameObject.GetComponent<GamePause>();
 }