コード例 #1
0
    private void Start()
    {
        playerControls = FindObjectOfType <PlayerControlsCanvas>();
        defeat         = FindObjectOfType <DefeatScreen>();
        options        = FindObjectOfType <InGameOptions>();
        camera         = Camera.main;

        attackButton  = playerControls.AttackButton;
        jumpButton    = playerControls.JumpButton;
        optionsButton = playerControls.OptionsButton;
        joystick      = playerControls.Joystick;

        #region Assertions
        Assert.IsNotNull(rigidbody);
        Assert.IsNotNull(animator);
        Assert.IsNotNull(characterSprite);
        Assert.IsNotNull(joystick);
        Assert.IsNotNull(jumpButton);
        Assert.IsNotNull(attackButton);
        Assert.IsNotNull(optionsButton);
        Assert.IsNotNull(camera);
        Assert.IsNotNull(defeat);
        Assert.IsNotNull(options);
        Assert.IsNotNull(playerControls);
        #endregion

        optionsButton.onClick.AddListener(GoToOptions);
        jumpButton.onClick.AddListener(Jump);
        attackButton.onClick.AddListener(Attack);
        isDead = false;
    }
コード例 #2
0
        private void processInput()
        {
            if (_state == State.Menu)
            {
                MenuOptions menuInput = _inputService.getMenuInput();
                switch (menuInput)
                {
                case MenuOptions.Credits:
                    break;

                case MenuOptions.HighScores:
                    break;

                case MenuOptions.None:
                    break;

                default:
                    Init_Maze(menuInput);
                    break;
                }
            }

            if (_state == State.InGame)
            {
                _inGameOptions = _inputService.getInGameOptions();
                _nextDirection = _inputService.getInputDirection();
            }
        }
コード例 #3
0
ファイル: Player.cs プロジェクト: techplays/horizon
    void Start()
    {
        //Carregar dados do jogador
        if (PlayerPrefs.GetString("FirstLoad", "true") == "true")
        {
            PlayerPrefs.SetString("FirstLoad", "false");
        }
        if (PlayerPrefs.GetString("IsNewGame", "true") == "false")
        {
            PlayerPrefs.SetString("IsNewGame", "false");
        }
        PlayerPrefs.SetInt("Level", SceneManager.GetActiveScene().buildIndex);

        // Obter RigidBody2D da personagem.
        rigBody        = GetComponent <Rigidbody2D>();
        spriteRenderer = GetComponent <SpriteRenderer>();
        animator       = GetComponent <Animator>();
        inGameOptions  = GetComponent <InGameOptions>();

        // Colocar o jogador no lado direito ou esquerdo do mapa baseado na localização anterior
        if (PlayerPrefs.GetInt("LoadDirection") == -1)
        {
            rigBody.position     = rightPosition;
            isFacingRight        = false;
            transform.localScale = new Vector3(-characterScale, characterScale, characterScale);
        }
        else
        {
            rigBody.position     = leftPosition;
            isFacingRight        = true;
            transform.localScale = new Vector3(characterScale, characterScale, characterScale);
        }
        rigBody.velocity = new Vector2(moveSpeed * PlayerPrefs.GetInt("LoadDirection"), 0);
    }
コード例 #4
0
ファイル: CityAll.cs プロジェクト: Niernen2033/MJ-RK
 private void Awake()
 {
     this.NormalInventory  = this.normalInventory.GetComponent <NormalInventory>();
     this.EqInventory      = this.equipmentInventory.GetComponent <EqInventory>();
     this.InGameOptions    = this.optionsMenu.GetComponent <InGameOptions>();
     this.championsButtons = this.teamChoose.GetComponentsInChildren <AvatarButton>();
     this.player           = GameSave.Instance.Player;
 }
コード例 #5
0
ファイル: DogeService.cs プロジェクト: shawnsmith88/cs5410
        public void HandleInGameOptions(GameObject gameObject, InGameOptions inGameOptions)
        {
            DogeSprite dogeSprite = (DogeSprite)gameObject;

            if (inGameOptions == InGameOptions.Breadcrumbs)
            {
                dogeSprite.ShowBreadCrumbs = !dogeSprite.ShowBreadCrumbs;
            }

            if (inGameOptions == InGameOptions.Hint)
            {
                dogeSprite.ShowHint = !dogeSprite.ShowHint;
            }

            if (inGameOptions == InGameOptions.ShortestPath)
            {
                dogeSprite.ShowBestPath = !dogeSprite.ShowBestPath;
            }
        }
コード例 #6
0
ファイル: PlayerAttack.cs プロジェクト: techplays/horizon
 void Start()
 {
     // Obter componentes da personagem
     anim          = GetComponent <Animator>();
     inGameOptions = GetComponent <InGameOptions>();
 }
コード例 #7
0
 public void HandleInGameOptions(GameObject gameObject, InGameOptions inGameOptions)
 {
     //finish line doesn't care about in game options
     return;
 }