A 2D Versus Shmup made in Unity
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

XboxController Support

james7132 520211a7 d801ae6f

+31 -12
+15
Assets/EnableController.cs
··· 1 + using UnityEngine; 2 + using System.Collections; 3 + 4 + public class EnableController : MonoBehaviour { 5 + 6 + // Use this for initialization 7 + void Start () { 8 + 9 + } 10 + 11 + // Update is called once per frame 12 + void Update () { 13 + 14 + } 15 + }
+8
Assets/EnableController.cs.meta
··· 1 + fileFormatVersion: 2 2 + guid: b7e605b539133c84b969d487b6139c2a 3 + MonoImporter: 4 + serializedVersion: 2 5 + defaultReferences: [] 6 + executionOrder: 0 7 + icon: {instanceID: 0} 8 + userData:
+7 -10
Assets/Scripts/PlayerControllers/ControlledAgent.cs
··· 2 2 using BaseLib; 3 3 using System.Collections; 4 4 5 - public class ControlledAgent : PlayerAgent 6 - { 5 + public class ControlledAgent : PlayerAgent { 7 6 private string horizontalMoveAxis; 8 7 private string verticalMoveAxis; 9 8 private string fireButton; 10 9 private string focusButton; 11 10 private string chargeButton; 12 11 13 - public override void Initialize (PlayerFieldController fieldController, Avatar playerAvatar, PlayerFieldController targetField) 14 - { 12 + public override void Initialize (PlayerFieldController fieldController, Avatar playerAvatar, PlayerFieldController targetField) { 15 13 base.Initialize (fieldController, playerAvatar, targetField); 16 14 string strPlay = "Player "; 17 15 int playerNumber = fieldController.PlayerNumber; ··· 22 20 chargeButton = "Charge " + strPlay + playerNumber; 23 21 } 24 22 25 - public override void Update (float dt) 26 - { 23 + public override void Update (float dt) { 27 24 Vector2 movementVector = Vector2.zero; 28 25 movementVector.x = Util.Sign(Input.GetAxis (horizontalMoveAxis)); 29 26 movementVector.y = Util.Sign(Input.GetAxis (verticalMoveAxis)); 30 27 //Debug.Log (horizontalMoveAxis + " : " + Input.GetAxis (horizontalMoveAxis)); 31 28 //Debug.Log ("movement vector: " + movementVector.ToString ()); 32 - bool focus = Input.GetAxis (focusButton) != 0f; 33 - bool fire = Input.GetAxis (fireButton) != 0f; 34 - bool charge = Input.GetAxis (chargeButton) != 0f; 29 + bool focus = Input.GetButton (focusButton); 30 + bool fire = Input.GetButton (fireButton); 31 + bool charge = Input.GetButton (chargeButton); 35 32 36 - PlayerAvatar.Move (Input.GetAxis (horizontalMoveAxis), Input.GetAxis (verticalMoveAxis), focus, dt); 33 + PlayerAvatar.Move (movementVector.x, movementVector.y, focus, dt); 37 34 if(fire) { 38 35 PlayerAvatar.StartFiring(); 39 36 } else {
+1 -2
Assets/Scripts/Test/TestSpawnPlayer.cs
··· 7 7 public GameObject character1; 8 8 public GameObject character2; 9 9 10 - void Start() 11 - { 10 + void Start() { 12 11 GameController controller = GetComponent<GameController> (); 13 12 controller.player1.Field.SpawnPlayer (character1, new ControlledAgent()); 14 13 controller.player2.Field.SpawnPlayer (character2, new ControlledAgent());