コード例 #1
0
ファイル: PlayerBehavior.cs プロジェクト: dezol/QuickStarters
        protected override void ResolveDependencies()
        {
            base.ResolveDependencies();

            this.leftJoystick = this.EntityManager.Find<Joystick>("leftJoystick");
            this.fireButton = this.EntityManager.Find<FireButton>("fireButton");
        }
コード例 #2
0
        private void UpdateInput()
        {
            if (UpButton.Down())
            {
                Physics.Thrust(_FLYSPEED);
            }
            else if (DownButton.Down())
            {
                Physics.Thrust(-_FLYSPEED);
            }

            if (LeftButton.Down())
            {
                Physics.AddAngularForce(-_TURNSPEED);
            }
            else if (RightButton.Down())
            {
                Physics.AddAngularForce(_TURNSPEED);
            }

            if (LookAnalog.Position != Vector2.Zero)
            {
                Body.Angle = Physics.GetAngle(new Vector2(-LookAnalog.Position.X, -LookAnalog.Position.Y));
            }

            if (ThrustTrigger.Value > ThrustTrigger.DeadZone)
            {
                Physics.Thrust(ThrustTrigger.Value * _FLYSPEED);
            }

            if (FireButton.RapidFire(250))
            {
                Gun.Fire();
            }
        }
コード例 #3
0
ファイル: PlayerBehavior.cs プロジェクト: tungnt92/WIS
        protected override void ResolveDependencies()
        {
            base.ResolveDependencies();

            this.leftJoystick = this.EntityManager.Find <Joystick>("leftJoystick");
            this.fireButton   = this.EntityManager.Find <FireButton>("fireButton");
        }
コード例 #4
0
    private void Awake()
    {
        if (Instance == null)
        {
            Instance = this;
        }
        else
        {
            Destroy(gameObject);
        }

        button = GetComponent <Button>();
    }
コード例 #5
0
 //根据玩家位置显示当前拥有的画笔
 public void showUIButton(int inkNum)
 {
     if (inkNum == 1)
     {
         WindButton.SetActive(true);
     }
     else if (inkNum == 2)
     {
         FireButton.SetActive(true);
     }
     else
     {
         print("UI show button has wrong input parameter");
     }
 }
コード例 #6
0
ファイル: InputManager.cs プロジェクト: mono26/Spooky
 public void GetInputFromButton()
 {
     if (Input.GetButton(FireButton.ButtonID))
     {
         FireButton.InvokeDown();
     }
     if (Input.GetButtonDown(FireButton.ButtonID))
     {
         FireButton.InvokePressed();
     }
     if (Input.GetButtonUp(FireButton.ButtonID))
     {
         FireButton.InvokeUp();
     }
 }
コード例 #7
0
    public void ClearInfoPanel()
    {
        WorkerImageObject.GetComponent <Image>().sprite = null;
        WorkerImageObject.GetComponent <Image>().color  = new Color(1f, 1f, 1f, 0);

        NameTextObject.GetComponent <Text>().text    = "";
        AgeTextObject.GetComponent <Text>().text     = "";
        PayTextObject.GetComponent <Text>().text     = "";
        AbilityTextObject.GetComponent <Text>().text = "";

        FatigueGraphBar.GetComponent <Image>().fillAmount    = 0f;
        ExperienceGraphBar.GetComponent <Image>().fillAmount = 0f;

        PromoteButton.GetComponent <Button>().interactable = false;
        FireButton.GetComponent <Button>().interactable    = false;

        CurrentWorkerIndex = -1;
    }
コード例 #8
0
    /////////////////////////////////////////////////
    //         メイン処理
    ////////////////////////////////////////////////
    void Update()
    {
        UpButton    upButton    = refObjUP.GetComponent <UpButton>();
        RightButton rightButton = refObjR.GetComponent <RightButton>();
        LeftButton  leftButton  = refObjL.GetComponent <LeftButton>();
        FireButton  fireButton  = refObjF.GetComponent <FireButton>();

        if (m_state != State.Damaged)
        {
            //キーでも反映
            float x    = rightButton.fRight + leftButton.fLeft + Input.GetAxis("Horizontal");
            bool  jump = upButton.bJump | Input.GetButtonDown("Jump");


            Move(x, jump);

            // 弾の発射処理
            if ((Input.GetKey(KeyCode.X) || fireButton.bfire) && bbulletflag)
            {
                Shot();
            }

            if (30 == nflame) //取り敢えず30fに一度の発射で
            {
                bbulletflag = true;
            }

            if (false == bbulletflag) //発射不能時のみカウント
            {
                nflame += 1;
            }

            if (false == jump) //ジャンプが二回読み込まれてしまったので一回だけにするように調整 
            {
                nfirstjump = 0;
            }

            if (bigjump)    // upobjectからのフラグでjump
            {
                m_rigidbody2D.AddForce(Vector2.up * jumpPower * 2);
                bigjump = false;
            }
        }
    }
コード例 #9
0
    private void Awake()
    {
        audioSource = GetComponent <AudioSource>();
        animator    = GetComponent <Animator>();
        sprite      = GetComponent <SpriteRenderer>();
        actionPanel = FindObjectOfType <ActionPanel>();
        terrain     = GameObject.FindGameObjectWithTag("Terrain").transform;

        uIActions = FindObjectOfType <UIActions>();

        chopButton  = actionPanel.lumberjack_chop.GetComponent <ChopButton>();
        digButton   = actionPanel.lumberjack_dig.GetComponent <DigButton>();
        plantButton = actionPanel.planter_plant.GetComponent <PlantButton>();
        waterButton = actionPanel.planter_water.GetComponent <WaterButton>();
        fireButton  = actionPanel.gameObject.transform.GetChild(8).GetComponent <FireButton>();

        selectionIndicator = transform.GetChild(0).gameObject; //Gets the indicator child game object
        fatigueSlider      = transform.SearchForChild("FatigueSlider").GetComponent <Slider>();

        moves = new List <direction>();
    }
コード例 #10
0
ファイル: LevelScreen.cs プロジェクト: Fedaykin1/Games
        public override void LoadContent()
        {
            base.LoadContent();

            info_bulle           = "Your number of moves (min number of moves to succeed)";
            position_texte_score = new Vector2(16, 8);

            design_button   = new DesignButton(ScreenManager.Instance.Content.Load <Texture2D>(@"Graphics\Buttons\design"), new Vector2(4 * 32, 0));
            fire_button     = new FireButton(ScreenManager.Instance.Content.Load <Texture2D>(@"Graphics\Buttons\fire"), new Vector2(5 * 32, 0));
            water_button    = new WaterButton(ScreenManager.Instance.Content.Load <Texture2D>(@"Graphics\Buttons\water"), new Vector2(6 * 32, 0));
            music_button    = new MusicButton(ScreenManager.Instance.Content.Load <Texture2D>(@"Graphics\Buttons\music"), new Vector2(8 * 32, 0));
            sound_button    = new SoundButton(ScreenManager.Instance.Content.Load <Texture2D>(@"Graphics\Buttons\sound"), new Vector2(9 * 32, 0));
            refresh_button  = new ReloadButton(ScreenManager.Instance.Content.Load <Texture2D>(@"Graphics\Buttons\refresh"), new Vector2(11 * 32, 0));
            previous_button = new PreviousButton(ScreenManager.Instance.Content.Load <Texture2D>(@"Graphics\Buttons\previous"), new Vector2(13 * 32, 0));
            next_button     = new NextButton(ScreenManager.Instance.Content.Load <Texture2D>(@"Graphics\Buttons\next"), new Vector2(14 * 32, 0));
            menu_button     = new MenuButton(ScreenManager.Instance.Content.Load <Texture2D>(@"Graphics\Buttons\menu"), new Vector2(16 * 32, 0));

            MapManager.Instance.LoadContent();
            LevelManager.Instance.LoadContent();
            Actor.Instance.LoadContent();

            InitializeMusic();
        }
コード例 #11
0
    public void DisplayInfo(int Index)
    {
        CurrentWorkerIndex = Index;

        SetHappinessImoji();
        NameTextObject.GetComponent <Text>().text    = CallEmployeeValue.EmployeeList[Index].BaseInfo.Name;
        AgeTextObject.GetComponent <Text>().text     = "Test";
        PayTextObject.GetComponent <Text>().text     = CallEmployeeValue.EmployeeList[Index].BaseInfo.Salary.ToString();
        AbilityTextObject.GetComponent <Text>().text = " x " + CallEmployeeValue.EmployeeList[Index].BaseInfo.LaborForce.ToString();

        FatigueGraphBar.gameObject.GetComponent <Image>().fillAmount    = CallEmployeeValue.EmployeeList[Index].FatigueValue / CallEmployeeValue.EmployeeList[Index].BaseInfo.LaborForce;
        ExperienceGraphBar.gameObject.GetComponent <Image>().fillAmount = CallEmployeeValue.EmployeeList[Index].Experience / (CallEmployeeValue.EmployeeList[Index].BaseInfo.LaborForce * 10);

        if (ExperienceGraphBar.GetComponent <Image>().fillAmount >= 1f)
        {
            PromoteButton.GetComponent <Button>().interactable = true;
        }
        else
        {
            PromoteButton.GetComponent <Button>().interactable = false;
        }
        FireButton.GetComponent <Button>().interactable = true;
    }
コード例 #12
0
ファイル: DialogHandler.cs プロジェクト: Xrocetoxtos/RPG2
    public void Talk(NpcAI npc, string title, string text, string button1, string button2, FireButton fb1, FireButton fb2, Quest quest = null, QuestGiver giver = null)
    {
        gameHandler.isPaused = true;
        questGiver           = giver;
        // generieke manier om dialoog op te zetten. berichten en worden gepassed naar deze method
        Time.timeScale = 0;
        npcAI          = npc;
        ToggleDialog(true);
        if (npc != null)
        {
            guiHandler.ViewGUImessage(guiHandler.dialogPartner, npc.gameObject.GetComponent <WorldObject>().objectTitle);
        }
        else
        {
            guiHandler.ViewGUImessage(guiHandler.dialogPartner, "Object");
        }
        guiHandler.ViewGUImessage(guiHandler.dialogTitle, title);
        guiHandler.ViewGUImessage(guiHandler.dialogDescription, text);
        guiHandler.ViewGUImessage(guiHandler.dialogButton1, button1);
        guiHandler.ViewGUImessage(guiHandler.dialogButton2, button2);

        PressButton1  = fb1;
        PressButton2  = fb2;
        questInDialog = quest;

        buttonClick1.gameObject.SetActive(true);
        buttonClick2.gameObject.SetActive(true);
        if (button1 == "")
        {
            buttonClick1.gameObject.SetActive(false);
        }
        if (button2 == "")
        {
            buttonClick2.gameObject.SetActive(false);
        }
    }
コード例 #13
0
ファイル: InputManager.cs プロジェクト: mono26/Spooky
 public virtual void FireButtonDown()
 {
     FireButton.ChangeButtonState(InputButton.ButtonStates.Down);
 }
コード例 #14
0
ファイル: PlayerMenu.cs プロジェクト: Wuschelbueb/Battleship
 public void OnKeyChange()
 {
     FireButton.GetComponentInChildren <Text> ().text  = "Press " + dataReference.FireKey + " to Fire (Change)";
     LeftButton.GetComponentInChildren <Text> ().text  = "Press " + dataReference.LeftKey + " to turn Left (Change)";
     RightButton.GetComponentInChildren <Text> ().text = "Press " + dataReference.RightKey + " to turn Right (Change)";
 }
コード例 #15
0
ファイル: InputManager.cs プロジェクト: mono26/Spooky
 public virtual void FireButtonUp()
 {
     FireButton.ChangeButtonState(InputButton.ButtonStates.Up);
 }
 void Start()
 {
     fireScript = GameObject.Find("Attack").GetComponent <FireButton>();
     TargetIndicator.gameObject.SetActive(false);
 }
コード例 #17
0
 void Start()
 {
     _fireButton = FindObjectOfType <FireButton>();
     _joystick   = FindObjectOfType <Joystick>();
     _rigidBody  = GetComponent <Rigidbody>();
 }
コード例 #18
0
ファイル: Input.cs プロジェクト: cuongdv/stg
 public override int GetHashCode()
 {
     return(LeverInput.GetHashCode() ^ FireButton.GetHashCode());
 }
コード例 #19
0
 // Use this for initialization
 void Start()
 {
     InkMelt = MiddleInklast.GetComponent <Image>().material;
     WindButton.SetActive(false);
     FireButton.SetActive(false);
 }
コード例 #20
0
ファイル: InputManager.cs プロジェクト: mono26/Spooky
 public virtual void FireButtonPressed()
 {
     FireButton.ChangeButtonState(InputButton.ButtonStates.Pressed);
 }