Advertisement
Guest User

Untitled

a guest
Nov 3rd, 2014
229
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.85 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class PlayerInputMobile : MonoBehaviour {
  5.  
  6.     public CNAbstractController movejoystick;
  7.     public CNAbstractController attackjoystick;    
  8.    
  9.     private Camera mainCamera;
  10.    
  11.     PlayerInput pI;
  12.    
  13.     void Start () {
  14.         pI = GetComponent<PlayerInput>();
  15.         if(movejoystick==null)
  16.             movejoystick = GameObject.FindWithTag("MovementJoystick").GetComponent<CNAbstractController>();
  17.         if(attackjoystick==null)
  18.             attackjoystick = GameObject.FindWithTag("AttackJoystick").GetComponent<CNAbstractController>();
  19.     }
  20.  
  21.     void Update () {
  22.         pI.mobileH = movejoystick.GetAxis("HorizontalA");
  23.         pI.mobileV = movejoystick.GetAxis("VerticalA");
  24.    
  25.         pI.mobileHAttack = attackjoystick.GetAxis("HorizontalArrow");
  26.         pI.mobileVAttack = attackjoystick.GetAxis("VerticalArrow");
  27.     }
  28.    
  29.    
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement