コード例 #1
0
    // Use this for initialization
    void Start()
    {
        moveJoystick = FindObjectOfType <VirtualJoyStick>();


        BulletFire.SetActive(false);
    }
コード例 #2
0
    private void Awake()
    {
        rollerCoverThrowUI  = GameObject.Find("RollerCoverThrowUI");
        rollerCoverJumpUI   = GameObject.Find("RollerCoverJumpUI");
        rollerCoverDownUI   = GameObject.Find("RollerCoverDownUI");
        rollerCoverPickupUI = GameObject.Find("RollerCoverPickupUI");
        rollerCoverBuff     = GameObject.Find("RollerCoverBuff");
        countDownObj_BuffUI = GameObject.Find("CountDownText_BuffUI");
        throwIcon           = GameObject.Find("ThrowEmptyLogo");
        emptyText           = GameObject.Find("EmptyText");
        countDownText       = GameObject.Find("CountDownText_ThrowUI");
        groupThrowPanelUI   = GameObject.Find("GroupThrowPanelUI");
        for (int i = 0; i < trashIcon.Length; i++)
        {
            trashIcon[i] = groupThrowPanelUI.transform.GetChild(i + 3).gameObject;
            trashIcon[i].SetActive(false);
        }
        for (int j = 0; j < trashIconText.Length; j++)
        {
            trashIconText[j] = groupThrowPanelUI.transform.GetChild(j + 14).gameObject;
            trashIconText[j].SetActive(false);
        }
        photonHandler phoHand = photonHandler.instance;

        photonPlayer = phoHand.photonPlayer;
        print(photonPlayer);
        scale        = transform.localScale;
        textObjScale = textObj.transform.localScale;
        gmr          = GameManager.instance;

        if (!devTesting && photonView.isMine)
        {
            sceneCam = GameObject.Find("Main Camera");
            if (sceneCam != null)
            {
                sceneCam.SetActive(false);
            }
            plCam.SetActive(true);

            photonView.RPC("SFXCeatorFind", PhotonTargets.AllBuffered);
            plNameText.text      = PhotonNetwork.playerName;
            joystick             = GameObject.Find("RollerScrollPanel").GetComponent <VirtualJoyStick>();
            countDownText_BuffUI = countDownObj_BuffUI.GetComponent <TextMeshProUGUI>();
            rollerCoverBuffImg   = rollerCoverBuff.GetComponent <Image>();
            buffBtn   = rollerCoverBuff.GetComponent <Button>();
            pickupBtn = rollerCoverPickupUI.GetComponent <ButtonController>();
            jumpBtn   = rollerCoverJumpUI.GetComponent <ButtonController>();
            downBtn   = rollerCoverDownUI.GetComponent <ButtonController>();
            throwBtn  = rollerCoverThrowUI.GetComponent <ButtonController>();
            countDownText.SetActive(false);
            countDownObj_BuffUI.SetActive(false);
            AddBuffButton();
        }

        if (!photonView.isMine)
        {
            plNameText.text = photonView.owner.name;
        }
    }
コード例 #3
0
    /**
     * @brief       캐릭터 조작에 필요한 조이스틱들을 초기화 합니다.
     */
    private void JoyStickInitialize()
    {
        // 플레이어 팀 정보
        ETeamInfo teamInfo = GameManager._instance.GetTeamInfo();

        // 이동에 대한 조이스틱을 찾음
        GameObject moveJoyStickObject = GameObject.FindWithTag("Move");

        if (moveJoyStickObject)
        {
            // 조이스틱 컴포넌트 설정
            moveJoyStick = moveJoyStickObject.GetComponent <VirtualJoyStick>();

            // 팀 정보에 맞게 캐릭터의 이동 방향을 설정함
            moveJoyStick.SetMoveDirection(teamInfo);
        }
        else
        {
            Debug.LogError("Have not Move JoyStick reference");
        }

        // 일반 공격에 대한 조이스틱을 찾음
        GameObject attackJoyStickObject = GameObject.FindWithTag("Attack");

        if (attackJoyStickObject)
        {
            // 조이스틱 컴포넌트 설정
            attackJoyStick = attackJoyStickObject.GetComponent <VirtualJoyStick>();

            // 일반 공격시 호출 될 함수 등록
            attackJoyStick.OnDragEnd += Attack;

            // 팀 정보에 맞게 캐릭터의 회전 방향을 설정함
            attackJoyStick.SetMoveDirection(teamInfo);
        }
        else
        {
            Debug.LogError("Have not Attack JoyStick reference");
        }

        // 스킬 공격에 대한 조이스틱을 찾음
        GameObject skillJoyStickObject = GameObject.FindWithTag("Skill");

        if (skillJoyStickObject)
        {
            // 조이스틱 컴포넌트 설정
            skillJoyStick = skillJoyStickObject.GetComponent <VirtualJoyStick>();

            // 특수 공격시 호출 될 함수 등록
            skillJoyStick.OnDragEnd += _player.UseSkill;

            // 팀 정보에 맞게 캐릭터의 회전 방향을 설정함
            skillJoyStick.SetMoveDirection(teamInfo);
        }
        else
        {
            Debug.LogError("Have not Skill JoyStick reference");
        }
    }
コード例 #4
0
    // Update is called once per frame
    private void Update()
    {
        if (!photonView.isMine)
        {
            return;
        }

        // Set controllable for current character
        if (!_controlling && PhotonNetwork.playerName == this.gameObject.GetComponent <Character>().UserName)
        {
            SetControllable();
            _controlling = true;
        }

        // Detect user input of movement
        GameObject joyStick = GameObjectFinder.FindJoyStick();

        if (joyStick == null)
        {
            return;
        }

        // Handle joystick input to move the character
        VirtualJoyStick vjs = joyStick.GetComponent <VirtualJoyStick>();
        Vector3         joyStickMovement = vjs.GetStickPosition();

        if (joyStickMovement != Vector3.zero)
        {
            _rb.AddForce(joyStickMovement * VELOCITY, ForceMode.Acceleration);
        }
        _rb.velocity = Vector3.ClampMagnitude(_rb.velocity, MAX_VELOCITY);

        // Handle joystick input to rotate the character towards
        // the same direction as the joystick
        if (!joyStickMovement.Equals(Vector3.zero))
        {
            Vector3 targetDir = joyStickMovement;
            float   step      = 10;
            Vector3 newDir    = Vector3.RotateTowards(transform.forward, targetDir, step, 0.0F);
            _lastRotation      = Quaternion.LookRotation(newDir);
            transform.rotation = _lastRotation;
            photonView.RPC("PlayAnim", PhotonTargets.All, "Move|Move");
        }
        else
        {
            transform.rotation = _lastRotation;
            photonView.RPC("PlayAnim", PhotonTargets.All, "Move|Idle");
        }
    }
コード例 #5
0
    public void OnSceneGUI()
    {
        VirtualJoyStick joystick = target as VirtualJoyStick;

        Handles.color = Color.yellow;

        if (!EditorApplication.isPlaying)
        {
            Handles.DrawWireDisc(joystick.transform.position, joystick.transform.forward, joystick.MovementRadius);
        }
        else
        {
            Handles.DrawWireDisc(joystick.InitialPosition, joystick.transform.forward, joystick.MovementRadius);
        }
    }
コード例 #6
0
 private void Awake()
 {
     Instance = this;
 }