コード例 #1
0
    private void CreateJoystick(Touch t)
    {
        if (currentJoystick)
        {
            return;
        }
        Transform tt = Instantiate(Joystick);

        currentJoystick = tt.GetComponent <MyJoystick>();
        currentJoystick.SetTouch(t);
    }
コード例 #2
0
 /// <summary>
 /// 輸入玩家的UI
 /// 使角色設定為玩家操控
 /// </summary>
 /// <param name="_input"></param>
 public void SetUserInput(MyJoystick _movement, MyUnityUI _attack, MyUnityUI[] _skill)
 {
     if (myBehavior == null)
     {
         return;
     }
     //更新技能使得圖案跟上
     myBehavior.InputUI(_movement, _attack, _skill);
     for (int i = 0; i < Skills.Length; i++)
     {
         SkillChange(Skills[i]);
     }
 }
コード例 #3
0
    /// <summary>
    /// 輸入玩家控制的UI
    /// </summary>
    /// <param name="_movement"></param>
    /// <param name="_attack"></param>
    /// <param name="_skill"></param>
    public void InputUI(MyJoystick _movement, MyUnityUI _attack, MyUnityUI[] _skill)
    {
        PlayerInput myInput     = input as PlayerInput;
        MyJoystick  oldMovement = null;
        MyUnityUI   oldAttack   = null;

        MyUnityUI[] oldSkill = null;
        if (myInput != null)
        {
            oldMovement = myInput.MovementController;
            oldAttack   = myInput.AttackButton;
            oldSkill    = myInput.SkillButton;
        }
        PlayerInput newInput = new PlayerInput(this)
        {
            MovementController = _movement == null ? oldMovement : _movement,
            AttackButton       = _attack == null ? oldAttack : _attack,
            SkillButton        = _skill == null? oldSkill : _skill
        };

        input = newInput;
    }
コード例 #4
0
 private void Start()
 {
     js            = this;
     bgImage       = GetComponent <Image> ();
     joystickImage = transform.GetChild(0).GetComponent <Image> ();
 }
コード例 #5
0
ファイル: InputReader.cs プロジェクト: allfa/Reborn
 private void CreateJoystick(Touch t)
 {
     if (currentJoystick)
         return;
     Transform tt = Instantiate (Joystick);
     currentJoystick=tt.GetComponent<MyJoystick>();
     currentJoystick.SetTouch (t);
 }