// make sure the constructor is private, so it can only be instantiated here public GameModel() { this.p1 = new Player(1); this.p2 = new Player(2); this.players = new Player[] { p1, p2 }; this.camera = new FightCamera( p1, p2 ); this.ui = GameObject.Find("UI").GetComponent<UI_Script>(); this.leftBoundary = camera.leftBoundary; this.rightBoundary = camera.rightBoundary; }
public FightCamera ( Player p1, Player p2 ) { this.camera = Camera.main; CameraInput input = this.camera.GetComponent<CameraInput>(); this.maxDistance = input.maxDistance; this.minZDistance = input.minZDistance; this.maxZDistance = input.maxZDistance; this.leftBoundary = input.leftBoundary; this.rightBoundary = input.rightBoundary; this.p1 = p1; this.p2 = p2; }
public GamePad(Player player){ int playerNumber = player.PlayerNumber; this.player = player; this.keys = new Dictionary<string, KeyCode>(); this.XAxis = "HorizontalP" + playerNumber; this.YAxis = "VerticalP" + playerNumber; this.AssignKeysByPlayerNumber(playerNumber); //Debug.Log(player.PlayerNumber.ToString() + " - XAxis: " + XAxis + " YAxis: " + YAxis); if (Application.platform.ToString().Substring(0, 3) == "OSX"){ this.keys["RegularJoystick"] = (KeyCode) Enum.Parse(typeof(KeyCode), "Joystick" + playerNumber + "Button18"); this.keys["UniqueJoystick"] = (KeyCode) Enum.Parse(typeof(KeyCode), "Joystick" + playerNumber + "Button19"); this.keys["SpecialJoystick"] = (KeyCode) Enum.Parse(typeof(KeyCode), "Joystick" + playerNumber + "Button17"); this.keys["BlockJoystick"] = (KeyCode) Enum.Parse(typeof(KeyCode), "Joystick" + playerNumber + "Button16"); } this.moveCommands = new int[] { MoveCommand.FORWARD, MoveCommand.FORWARD_DOWN, MoveCommand.FORWARD_UP, MoveCommand.BACK, MoveCommand.BACK_DOWN, MoveCommand.BACK_UP, MoveCommand.UP, MoveCommand.DOWN, MoveCommand.NONE }; this.actionCommands = new int[] { ActionCommand.REGULAR, ActionCommand.UNIQUE, ActionCommand.SPECIAL, ActionCommand.BLOCK, ActionCommand.NONE }; }