Пример #1
0
	public void _initializeController()
	{
		if (IsInitialized()) return;

		input = new ControllerInput(playerId);

		leftWing = new BirdWing(transform.FindInChildren("Shoulder_L"), "_L", input, this);
		rightWing = new BirdWing(transform.FindInChildren("Shoulder_R"), "_R", input, this);

		leftWing.trigger = ControllerAction.R2;
		rightWing.trigger = ControllerAction.L2;


		leftLeg = new BirdLeg(transform.FindInChildren("Leg_Feet_L"), "_L", input);
		rightLeg = new BirdLeg(transform.FindInChildren("Leg_Feet_R"), "_R", input);


		head = new BirdHead(transform.FindInChildren("Neck"), input, this);

		body = new BirdBody(transform.FindInChildren("Body"), input, this);

		tail = new BirdTail(transform.FindInChildren("Tail_1"), input, this);

		_isInitialized = true;
	}
Пример #2
0
	public PoseDiff CompareWithController(ControllerInput controller, float progress)
	{
		int firstPhase = (int)Mathf.Floor(progress/phaseLength);
		int secondPhase = firstPhase + 1;

		if (data.count == 1)
		{
			secondPhase = 0;
		}

		PoseData firstPose = data.poses [firstPhase];
		PoseData secondPose = data.poses [secondPhase];

		PoseData desiredPose = new PoseData();

		float subProgress = progress % phaseLength;
		subProgress /= phaseLength;	//normalize it;

		desiredPose.leftWing = firstPose.leftWing + (secondPose.leftWing - firstPose.leftWing) * subProgress;
		desiredPose.rightWing = firstPose.rightWing + (secondPose.rightWing - firstPose.rightWing) * subProgress;

		desiredPose.head.x = firstPose.head.x + (secondPose.head.x - firstPose.head.x) * subProgress;
		desiredPose.head.y = firstPose.head.y + (secondPose.head.y - firstPose.head.y) * subProgress;

		desiredPose.tail.x = firstPose.tail.x + (secondPose.tail.x - firstPose.tail.x) * subProgress;
		desiredPose.tail.y = firstPose.tail.y + (secondPose.tail.y - firstPose.tail.y) * subProgress;

		PoseData controllerPose = CalculateFromController(controller);

		return CalculatePoseDiffs (desiredPose, controllerPose);
	}
Пример #3
0
	public BirdBody(Transform temp, ControllerInput input, BirdControl birdControl)
	{
		this.input = input;
		this.birdControl = birdControl;

		body = BirdBone.CreateBirdBone(temp);
	}
Пример #4
0
	void Start ()
	{
		input = new ControllerInput(playerNumber);
		SetStartingValues(head);
		SetStartingValues(tail);
		SetStartingValues(leftWing);
		SetStartingValues(rightWing);
	}
Пример #5
0
	public BirdTail(Transform firstTail, ControllerInput input, BirdControl birdControl)
	{
		this.input = input;
		this.birdControl = birdControl;

		tail_1 = BirdBone.CreateBirdBone(firstTail);
		tail_2 = BirdBone.CreateBirdBone(firstTail.FindInChildren("Tail_2"));
		tail_3 = BirdBone.CreateBirdBone(firstTail.FindInChildren("Tail_3"));

	}
Пример #6
0
 public ControllerInput GetInput(Time elapsedTime)
 {
     KeyboardState keyboardState = Keyboard.GetState(_playerIndex);
     ControllerInput input = new ControllerInput(previousCallInput, elapsedTime,
         keyboardState.IsKeyDown(Keys.Enter), keyboardState.IsKeyDown(Keys.Add),
         keyboardState.IsKeyDown(Keys.NumPad4), keyboardState.IsKeyDown(Keys.NumPad1),
         keyboardState.IsKeyDown(Keys.NumPad7), keyboardState.IsKeyDown(Keys.NumPad3),
         keyboardState.IsKeyDown(Keys.NumPad5), keyboardState.IsKeyDown(Keys.NumPad0),
         keyboardState.IsKeyDown(Keys.Decimal), keyboardState.IsKeyDown(Keys.NumPad6),
         keyboardState.IsKeyDown(Keys.NumPad2));
     previousCallInput = input;
     return input;
 }
Пример #7
0
	public BirdHead(Transform neckTransfrom, ControllerInput input, BirdControl birdControl)
	{
		this.input = input;
		this.birdControl = birdControl;

		neck = BirdBone.CreateBirdBone(neckTransfrom);

		head = BirdBone.CreateBirdBone(neckTransfrom.FindInChildren("Head"));

		beack = BirdBone.CreateBirdBone(neckTransfrom.FindInChildren("Head_Beak_Lower"));

		//headFeather = BirdBone.CreateBirdBone(neckTransfrom.FindInChildren("Head_Feather"));

	}
Пример #8
0
	// Use this for initialization
	void Start ()
	{
		startPressed = false;

		gameManager = GameObject.Find("GameManager").GetComponent<GameSceneMaster>();
		initialLogoLocalPosition = LogoGameObject.transform.localPosition;
		//curtainDownPos = curtainTransform.position;

		debugControllerInput = new ControllerInput(1);

		stageCamera = GetComponent<StageCamera>();

		targetBalconyBirdPos = balconyObjects.balconyBird.transform.localPosition;
		targetBalconyLightIntensity = balconyObjects.balconySpotlight.intensity;
		targetBalconyLightSpotAngle = balconyObjects.balconySpotlight.spotAngle;


		stageCamera.cameraFocalPoint.position= LogoGameObject.transform.position;
	}
Пример #9
0
	public BirdWing(Transform shoulderTransform, string suffix, ControllerInput input, BirdControl birdControl)
	{
		this.input = input;
		this.birdControl = birdControl;

		if (suffix == "_L")
			sign = -1f;


		shoulder = BirdBone.CreateBirdBone(shoulderTransform);

		wing_1 = BirdBone.CreateBirdBone(shoulderTransform.FindInChildren("Wing_1" + suffix));

		//wing_1_f = BirdBone.CreateBirdBone(shoulderTransform.FindInChildren("Wing_F_1" + suffix));

		wing_2 = BirdBone.CreateBirdBone(shoulderTransform.FindInChildren("Wing_2" + suffix));
		wing_2_f = BirdBone.CreateBirdBone(shoulderTransform.FindInChildren("Wing_F_2" + suffix));

		wing_3 = BirdBone.CreateBirdBone(shoulderTransform.FindInChildren("Wing_3" + suffix));
		//wing_3_f = BirdBone.CreateBirdBone(shoulderTransform.FindInChildren("Wing_F_3" + suffix));
	}
Пример #10
0
	public BirdLeg(Transform feetTransform, string suffix, ControllerInput input)
	{
		if (suffix == "_L")
		{
			isLeft = true;
			//sign = -1f;
		}

		//this.input = input;

		leg_feet = BirdBone.CreateBirdBone(feetTransform);

		leg_heel = BirdBone.CreateBirdBone(feetTransform.FindInChildren("Leg_Heel" + suffix));

		leg_lower = BirdBone.CreateBirdBone(feetTransform.FindInChildren("Leg_Lower" + suffix));

		leg_upper = BirdBone.CreateBirdBone(feetTransform.FindInChildren("Leg_Upper" + suffix));

		hip = BirdBone.CreateBirdBone(feetTransform.FindInChildren("Hip" + suffix));


	}
Пример #11
0
    //Function called when this object is created
    private void Awake()
    {
        //Getting the movement component references
        this.ourFreeMovement = this.GetComponent <FreeMovementFlight>();
        this.ourRailMovement = this.GetComponent <RailMovementFlight>();

        //Getting our controller input based on which player this is
        switch (this.playerController)
        {
        case Players.P1:
            //Making sure there's not already a static reference to the p1 ship
            if (p1ShipRef == null)
            {
                p1ShipRef            = this;
                this.ourController   = ControllerInputManager.P1Controller;
                this.ourCustomInputs = CustomInputSettings.globalReference.p1Inputs;
            }
            //If there's already a static reference for the p1 ship and not one for the p2 ship
            else if (p2ShipRef == null)
            {
                this.playerController = Players.P2;
                p2ShipRef             = this;
                this.ourController    = ControllerInputManager.P2Controller;
                this.ourCustomInputs  = CustomInputSettings.globalReference.p2Inputs;
            }
            //If there are already static references to both ships, we disable this object
            {
                this.gameObject.SetActive(false);
            }
            break;

        case Players.P2:
            //Making sure there's not already a static reference to the p2 ship
            if (p2ShipRef == null)
            {
                p2ShipRef            = this;
                this.ourController   = ControllerInputManager.P2Controller;
                this.ourCustomInputs = CustomInputSettings.globalReference.p2Inputs;
            }
            //If there's already a static reference for the p2 ship, we disable this object
            else
            {
                this.gameObject.SetActive(false);
            }
            break;

        default:
            //Making sure there's not already a static reference to the p1 ship
            if (p1ShipRef == null)
            {
                p1ShipRef            = this;
                this.ourController   = ControllerInputManager.P1Controller;
                this.ourCustomInputs = CustomInputSettings.globalReference.p1Inputs;
            }
            //If there's already a static reference for the p1 ship and not one for the p2 ship
            else if (p2ShipRef == null)
            {
                this.playerController = Players.P2;
                p2ShipRef             = this;
                this.ourController    = ControllerInputManager.P2Controller;
                this.ourCustomInputs  = CustomInputSettings.globalReference.p2Inputs;
            }
            //If there are already static references to both ships, we disable this object
            {
                this.gameObject.SetActive(false);
            }
            break;
        }

        //Passing our controller input to our movement mechanic scripts
        this.ourFreeMovement.ourShip = this;
        this.ourRailMovement.ourShip = this;

        //Getting our health and armor component reference
        this.ourHealth = this.GetComponent <HealthAndArmor>();
        //Getting our energy component reference
        this.ourEnergy = this.GetComponent <ShipEnergy>();

        //Looping through all of our weapons, wings and engines to tell them what player ID we are
        if (this.playerController == Players.P1)
        {
            this.mainWeapon.objectIDType      = AttackerID.Player1;
            this.secondaryWeapon.objectIDType = AttackerID.Player1;
            this.shipCockpit.objectIDType     = AttackerID.Player1;
        }
        else
        {
            this.mainWeapon.objectIDType      = AttackerID.Player2;
            this.secondaryWeapon.objectIDType = AttackerID.Player2;
            this.shipCockpit.objectIDType     = AttackerID.Player2;
        }
        foreach (ShipWingLogic wing in this.shipWings)
        {
            if (this.playerController == Players.P1)
            {
                wing.objectIDType = AttackerID.Player1;
            }
            else if (this.playerController == Players.P2)
            {
                wing.objectIDType = AttackerID.Player2;
            }
        }
        foreach (ShipEngineLogic engine in this.shipEngines)
        {
            if (this.playerController == Players.P1)
            {
                engine.objectIDType = AttackerID.Player1;
            }
            else if (this.playerController == Players.P2)
            {
                engine.objectIDType = AttackerID.Player2;
            }
        }

        //Getting the default pitch for the engine sound effect
        this.defaultPitch = this.engineSoundEmitter.ownerAudio.pitch;
    }
Пример #12
0
        //Process controller input for keyboard
        public void ControllerInteractionKeyboard(ControllerInput controllerInput)
        {
            try
            {
                if (GetSystemTicksMs() >= vControllerDelay_KeypadControl)
                {
                    KeyboardModifiers pressedModifiers = KeyboardModifiers.None;
                    byte[]            pressedKeys      = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
                    int keyIndex = 0;

                    //DPad
                    if (controllerInput.DPadLeft.PressedRaw)
                    {
                        if (vKeypadMappingProfile.DPadLeftMod0 != KeyboardModifiers.None)
                        {
                            pressedModifiers |= vKeypadMappingProfile.DPadLeftMod0;
                        }
                        if (vKeypadMappingProfile.DPadLeftMod1 != KeyboardModifiers.None)
                        {
                            pressedModifiers |= vKeypadMappingProfile.DPadLeftMod1;
                        }
                        if (vKeypadMappingProfile.DPadLeft != KeyboardKeys.None)
                        {
                            UpdateKeyPressByteArray(ref pressedKeys, ref keyIndex, vKeypadMappingProfile.DPadLeft);
                        }
                    }
                    if (controllerInput.DPadRight.PressedRaw)
                    {
                        if (vKeypadMappingProfile.DPadRightMod0 != KeyboardModifiers.None)
                        {
                            pressedModifiers |= vKeypadMappingProfile.DPadRightMod0;
                        }
                        if (vKeypadMappingProfile.DPadRightMod1 != KeyboardModifiers.None)
                        {
                            pressedModifiers |= vKeypadMappingProfile.DPadRightMod1;
                        }
                        if (vKeypadMappingProfile.DPadRight != KeyboardKeys.None)
                        {
                            UpdateKeyPressByteArray(ref pressedKeys, ref keyIndex, vKeypadMappingProfile.DPadRight);
                        }
                    }
                    if (controllerInput.DPadUp.PressedRaw)
                    {
                        if (vKeypadMappingProfile.DPadUpMod0 != KeyboardModifiers.None)
                        {
                            pressedModifiers |= vKeypadMappingProfile.DPadUpMod0;
                        }
                        if (vKeypadMappingProfile.DPadUpMod1 != KeyboardModifiers.None)
                        {
                            pressedModifiers |= vKeypadMappingProfile.DPadUpMod1;
                        }
                        if (vKeypadMappingProfile.DPadUp != KeyboardKeys.None)
                        {
                            UpdateKeyPressByteArray(ref pressedKeys, ref keyIndex, vKeypadMappingProfile.DPadUp);
                        }
                    }
                    if (controllerInput.DPadDown.PressedRaw)
                    {
                        if (vKeypadMappingProfile.DPadDownMod0 != KeyboardModifiers.None)
                        {
                            pressedModifiers |= vKeypadMappingProfile.DPadDownMod0;
                        }
                        if (vKeypadMappingProfile.DPadDownMod1 != KeyboardModifiers.None)
                        {
                            pressedModifiers |= vKeypadMappingProfile.DPadDownMod1;
                        }
                        if (vKeypadMappingProfile.DPadDown != KeyboardKeys.None)
                        {
                            UpdateKeyPressByteArray(ref pressedKeys, ref keyIndex, vKeypadMappingProfile.DPadDown);
                        }
                    }

                    //Thumb Left
                    if (controllerInput.ThumbLeftX < -vControllerThumbOffset7500)
                    {
                        if (vKeypadMappingProfile.ThumbLeftLeftMod0 != KeyboardModifiers.None)
                        {
                            pressedModifiers |= vKeypadMappingProfile.ThumbLeftLeftMod0;
                        }
                        if (vKeypadMappingProfile.ThumbLeftLeftMod1 != KeyboardModifiers.None)
                        {
                            pressedModifiers |= vKeypadMappingProfile.ThumbLeftLeftMod1;
                        }
                        if (vKeypadMappingProfile.ThumbLeftLeft != KeyboardKeys.None)
                        {
                            UpdateKeyPressByteArray(ref pressedKeys, ref keyIndex, vKeypadMappingProfile.ThumbLeftLeft);
                        }
                    }
                    if (controllerInput.ThumbLeftY > vControllerThumbOffset7500)
                    {
                        if (vKeypadMappingProfile.ThumbLeftUpMod0 != KeyboardModifiers.None)
                        {
                            pressedModifiers |= vKeypadMappingProfile.ThumbLeftUpMod0;
                        }
                        if (vKeypadMappingProfile.ThumbLeftUpMod1 != KeyboardModifiers.None)
                        {
                            pressedModifiers |= vKeypadMappingProfile.ThumbLeftUpMod1;
                        }
                        if (vKeypadMappingProfile.ThumbLeftUp != KeyboardKeys.None)
                        {
                            UpdateKeyPressByteArray(ref pressedKeys, ref keyIndex, vKeypadMappingProfile.ThumbLeftUp);
                        }
                    }
                    if (controllerInput.ThumbLeftX > vControllerThumbOffset7500)
                    {
                        if (vKeypadMappingProfile.ThumbLeftRightMod0 != KeyboardModifiers.None)
                        {
                            pressedModifiers |= vKeypadMappingProfile.ThumbLeftRightMod0;
                        }
                        if (vKeypadMappingProfile.ThumbLeftRightMod1 != KeyboardModifiers.None)
                        {
                            pressedModifiers |= vKeypadMappingProfile.ThumbLeftRightMod1;
                        }
                        if (vKeypadMappingProfile.ThumbLeftRight != KeyboardKeys.None)
                        {
                            UpdateKeyPressByteArray(ref pressedKeys, ref keyIndex, vKeypadMappingProfile.ThumbLeftRight);
                        }
                    }
                    if (controllerInput.ThumbLeftY < -vControllerThumbOffset7500)
                    {
                        if (vKeypadMappingProfile.ThumbLeftDownMod0 != KeyboardModifiers.None)
                        {
                            pressedModifiers |= vKeypadMappingProfile.ThumbLeftDownMod0;
                        }
                        if (vKeypadMappingProfile.ThumbLeftDownMod1 != KeyboardModifiers.None)
                        {
                            pressedModifiers |= vKeypadMappingProfile.ThumbLeftDownMod1;
                        }
                        if (vKeypadMappingProfile.ThumbLeftDown != KeyboardKeys.None)
                        {
                            UpdateKeyPressByteArray(ref pressedKeys, ref keyIndex, vKeypadMappingProfile.ThumbLeftDown);
                        }
                    }

                    //Thumb Right
                    if (!vKeypadMappingProfile.KeypadMouseMoveEnabled)
                    {
                        if (controllerInput.ThumbRightX < -vControllerThumbOffset7500)
                        {
                            if (vKeypadMappingProfile.ThumbRightLeftMod0 != KeyboardModifiers.None)
                            {
                                pressedModifiers |= vKeypadMappingProfile.ThumbRightLeftMod0;
                            }
                            if (vKeypadMappingProfile.ThumbRightLeftMod1 != KeyboardModifiers.None)
                            {
                                pressedModifiers |= vKeypadMappingProfile.ThumbRightLeftMod1;
                            }
                            if (vKeypadMappingProfile.ThumbRightLeft != KeyboardKeys.None)
                            {
                                UpdateKeyPressByteArray(ref pressedKeys, ref keyIndex, vKeypadMappingProfile.ThumbRightLeft);
                            }
                        }
                        if (controllerInput.ThumbRightX > vControllerThumbOffset7500)
                        {
                            if (vKeypadMappingProfile.ThumbRightRightMod0 != KeyboardModifiers.None)
                            {
                                pressedModifiers |= vKeypadMappingProfile.ThumbRightRightMod0;
                            }
                            if (vKeypadMappingProfile.ThumbRightRightMod1 != KeyboardModifiers.None)
                            {
                                pressedModifiers |= vKeypadMappingProfile.ThumbRightRightMod1;
                            }
                            if (vKeypadMappingProfile.ThumbRightRight != KeyboardKeys.None)
                            {
                                UpdateKeyPressByteArray(ref pressedKeys, ref keyIndex, vKeypadMappingProfile.ThumbRightRight);
                            }
                        }
                        if (controllerInput.ThumbRightY > vControllerThumbOffset7500)
                        {
                            if (vKeypadMappingProfile.ThumbRightUpMod0 != KeyboardModifiers.None)
                            {
                                pressedModifiers |= vKeypadMappingProfile.ThumbRightUpMod0;
                            }
                            if (vKeypadMappingProfile.ThumbRightUpMod1 != KeyboardModifiers.None)
                            {
                                pressedModifiers |= vKeypadMappingProfile.ThumbRightUpMod1;
                            }
                            if (vKeypadMappingProfile.ThumbRightUp != KeyboardKeys.None)
                            {
                                UpdateKeyPressByteArray(ref pressedKeys, ref keyIndex, vKeypadMappingProfile.ThumbRightUp);
                            }
                        }
                        if (controllerInput.ThumbRightY < -vControllerThumbOffset7500)
                        {
                            if (vKeypadMappingProfile.ThumbRightDownMod0 != KeyboardModifiers.None)
                            {
                                pressedModifiers |= vKeypadMappingProfile.ThumbRightDownMod0;
                            }
                            if (vKeypadMappingProfile.ThumbRightDownMod1 != KeyboardModifiers.None)
                            {
                                pressedModifiers |= vKeypadMappingProfile.ThumbRightDownMod1;
                            }
                            if (vKeypadMappingProfile.ThumbRightDown != KeyboardKeys.None)
                            {
                                UpdateKeyPressByteArray(ref pressedKeys, ref keyIndex, vKeypadMappingProfile.ThumbRightDown);
                            }
                        }
                    }

                    //Buttons
                    if (controllerInput.ButtonA.PressedRaw)
                    {
                        if (vKeypadMappingProfile.ButtonAMod0 != KeyboardModifiers.None)
                        {
                            pressedModifiers |= vKeypadMappingProfile.ButtonAMod0;
                        }
                        if (vKeypadMappingProfile.ButtonAMod1 != KeyboardModifiers.None)
                        {
                            pressedModifiers |= vKeypadMappingProfile.ButtonAMod1;
                        }
                        if (vKeypadMappingProfile.ButtonA != KeyboardKeys.None)
                        {
                            UpdateKeyPressByteArray(ref pressedKeys, ref keyIndex, vKeypadMappingProfile.ButtonA);
                        }
                    }
                    if (controllerInput.ButtonB.PressedRaw)
                    {
                        if (vKeypadMappingProfile.ButtonBMod0 != KeyboardModifiers.None)
                        {
                            pressedModifiers |= vKeypadMappingProfile.ButtonBMod0;
                        }
                        if (vKeypadMappingProfile.ButtonBMod1 != KeyboardModifiers.None)
                        {
                            pressedModifiers |= vKeypadMappingProfile.ButtonBMod1;
                        }
                        if (vKeypadMappingProfile.ButtonB != KeyboardKeys.None)
                        {
                            UpdateKeyPressByteArray(ref pressedKeys, ref keyIndex, vKeypadMappingProfile.ButtonB);
                        }
                    }
                    if (controllerInput.ButtonX.PressedRaw)
                    {
                        if (vKeypadMappingProfile.ButtonXMod0 != KeyboardModifiers.None)
                        {
                            pressedModifiers |= vKeypadMappingProfile.ButtonXMod0;
                        }
                        if (vKeypadMappingProfile.ButtonXMod1 != KeyboardModifiers.None)
                        {
                            pressedModifiers |= vKeypadMappingProfile.ButtonXMod1;
                        }
                        if (vKeypadMappingProfile.ButtonX != KeyboardKeys.None)
                        {
                            UpdateKeyPressByteArray(ref pressedKeys, ref keyIndex, vKeypadMappingProfile.ButtonX);
                        }
                    }
                    if (controllerInput.ButtonY.PressedRaw)
                    {
                        if (vKeypadMappingProfile.ButtonYMod0 != KeyboardModifiers.None)
                        {
                            pressedModifiers |= vKeypadMappingProfile.ButtonYMod0;
                        }
                        if (vKeypadMappingProfile.ButtonYMod1 != KeyboardModifiers.None)
                        {
                            pressedModifiers |= vKeypadMappingProfile.ButtonYMod1;
                        }
                        if (vKeypadMappingProfile.ButtonY != KeyboardKeys.None)
                        {
                            UpdateKeyPressByteArray(ref pressedKeys, ref keyIndex, vKeypadMappingProfile.ButtonY);
                        }
                    }
                    if (controllerInput.ButtonBack.PressedRaw)
                    {
                        if (vKeypadMappingProfile.ButtonBackMod0 != KeyboardModifiers.None)
                        {
                            pressedModifiers |= vKeypadMappingProfile.ButtonBackMod0;
                        }
                        if (vKeypadMappingProfile.ButtonBackMod1 != KeyboardModifiers.None)
                        {
                            pressedModifiers |= vKeypadMappingProfile.ButtonBackMod1;
                        }
                        if (vKeypadMappingProfile.ButtonBack != KeyboardKeys.None)
                        {
                            UpdateKeyPressByteArray(ref pressedKeys, ref keyIndex, vKeypadMappingProfile.ButtonBack);
                        }
                    }
                    if (controllerInput.ButtonStart.PressedRaw)
                    {
                        if (vKeypadMappingProfile.ButtonStartMod0 != KeyboardModifiers.None)
                        {
                            pressedModifiers |= vKeypadMappingProfile.ButtonStartMod0;
                        }
                        if (vKeypadMappingProfile.ButtonStartMod1 != KeyboardModifiers.None)
                        {
                            pressedModifiers |= vKeypadMappingProfile.ButtonStartMod1;
                        }
                        if (vKeypadMappingProfile.ButtonStart != KeyboardKeys.None)
                        {
                            UpdateKeyPressByteArray(ref pressedKeys, ref keyIndex, vKeypadMappingProfile.ButtonStart);
                        }
                    }

                    //Shoulder
                    if (controllerInput.ButtonShoulderLeft.PressedRaw)
                    {
                        if (vKeypadMappingProfile.ButtonShoulderLeftMod0 != KeyboardModifiers.None)
                        {
                            pressedModifiers |= vKeypadMappingProfile.ButtonShoulderLeftMod0;
                        }
                        if (vKeypadMappingProfile.ButtonShoulderLeftMod1 != KeyboardModifiers.None)
                        {
                            pressedModifiers |= vKeypadMappingProfile.ButtonShoulderLeftMod1;
                        }
                        if (vKeypadMappingProfile.ButtonShoulderLeft != KeyboardKeys.None)
                        {
                            UpdateKeyPressByteArray(ref pressedKeys, ref keyIndex, vKeypadMappingProfile.ButtonShoulderLeft);
                        }
                    }
                    if (controllerInput.ButtonShoulderRight.PressedRaw)
                    {
                        if (vKeypadMappingProfile.ButtonShoulderRightMod0 != KeyboardModifiers.None)
                        {
                            pressedModifiers |= vKeypadMappingProfile.ButtonShoulderRightMod0;
                        }
                        if (vKeypadMappingProfile.ButtonShoulderRightMod1 != KeyboardModifiers.None)
                        {
                            pressedModifiers |= vKeypadMappingProfile.ButtonShoulderRightMod1;
                        }
                        if (vKeypadMappingProfile.ButtonShoulderRight != KeyboardKeys.None)
                        {
                            UpdateKeyPressByteArray(ref pressedKeys, ref keyIndex, vKeypadMappingProfile.ButtonShoulderRight);
                        }
                    }

                    //Trigger
                    if (controllerInput.ButtonTriggerLeft.PressedRaw)
                    {
                        if (vKeypadMappingProfile.ButtonTriggerLeftMod0 != KeyboardModifiers.None)
                        {
                            pressedModifiers |= vKeypadMappingProfile.ButtonTriggerLeftMod0;
                        }
                        if (vKeypadMappingProfile.ButtonTriggerLeftMod1 != KeyboardModifiers.None)
                        {
                            pressedModifiers |= vKeypadMappingProfile.ButtonTriggerLeftMod1;
                        }
                        if (vKeypadMappingProfile.ButtonTriggerLeft != KeyboardKeys.None)
                        {
                            UpdateKeyPressByteArray(ref pressedKeys, ref keyIndex, vKeypadMappingProfile.ButtonTriggerLeft);
                        }
                    }
                    if (controllerInput.ButtonTriggerRight.PressedRaw)
                    {
                        if (vKeypadMappingProfile.ButtonTriggerRightMod0 != KeyboardModifiers.None)
                        {
                            pressedModifiers |= vKeypadMappingProfile.ButtonTriggerRightMod0;
                        }
                        if (vKeypadMappingProfile.ButtonTriggerRightMod1 != KeyboardModifiers.None)
                        {
                            pressedModifiers |= vKeypadMappingProfile.ButtonTriggerRightMod1;
                        }
                        if (vKeypadMappingProfile.ButtonTriggerRight != KeyboardKeys.None)
                        {
                            UpdateKeyPressByteArray(ref pressedKeys, ref keyIndex, vKeypadMappingProfile.ButtonTriggerRight);
                        }
                    }

                    //Thumb
                    if (controllerInput.ButtonThumbLeft.PressedRaw)
                    {
                        if (vKeypadMappingProfile.ButtonThumbLeftMod0 != KeyboardModifiers.None)
                        {
                            pressedModifiers |= vKeypadMappingProfile.ButtonThumbLeftMod0;
                        }
                        if (vKeypadMappingProfile.ButtonThumbLeftMod1 != KeyboardModifiers.None)
                        {
                            pressedModifiers |= vKeypadMappingProfile.ButtonThumbLeftMod1;
                        }
                        if (vKeypadMappingProfile.ButtonThumbLeft != KeyboardKeys.None)
                        {
                            UpdateKeyPressByteArray(ref pressedKeys, ref keyIndex, vKeypadMappingProfile.ButtonThumbLeft);
                        }
                    }
                    if (controllerInput.ButtonThumbRight.PressedRaw)
                    {
                        if (vKeypadMappingProfile.ButtonThumbRightMod0 != KeyboardModifiers.None)
                        {
                            pressedModifiers |= vKeypadMappingProfile.ButtonThumbRightMod0;
                        }
                        if (vKeypadMappingProfile.ButtonThumbRightMod1 != KeyboardModifiers.None)
                        {
                            pressedModifiers |= vKeypadMappingProfile.ButtonThumbRightMod1;
                        }
                        if (vKeypadMappingProfile.ButtonThumbRight != KeyboardKeys.None)
                        {
                            UpdateKeyPressByteArray(ref pressedKeys, ref keyIndex, vKeypadMappingProfile.ButtonThumbRight);
                        }
                    }

                    //Send key presses to keyboard
                    vFakerInputDevice.KeyboardPressByte((byte)pressedModifiers, pressedKeys);

                    //Delay input to prevent repeat
                    vControllerDelay_KeypadControl = GetSystemTicksMs() + vControllerDelayTicks10;
                }
            }
            catch { }
        }
Пример #13
0
	public static PoseData CalculateFromController(ControllerInput controller)
	{
		PoseData result = new PoseData ();

		result.leftWing = controller.GetAxis (ControllerAction.L2);
		result.rightWing = controller.GetAxis (ControllerAction.R2);
		result.head.x = controller.GetAxis (ControllerAction.LEFT_STICK_X);
		result.head.y = controller.GetAxis (ControllerAction.LEFT_STICK_Y);
		result.tail.x = controller.GetAxis (ControllerAction.RIGHT_STICK_X);
		result.tail.y = controller.GetAxis (ControllerAction.RIGHT_STICK_Y);

		return result;
	}
Пример #14
0
 public static bool Pressed_RightBumper(Key key = Key.IS_PRESSED)
 {
     return(ControllerInput.ButtonPress("5", key));
 }
Пример #15
0
 public static bool Pressed_StartButton(Key key = Key.IS_PRESSED)
 {
     return(ControllerInput.ButtonPress("7", key));
 }
Пример #16
0
	// Use this for initialization
	void Start ()
	{
		input = new ControllerInput(1);
	}
Пример #17
0
 void OnController(ControllerInput input)
 {
     this.leftLevel  = input.LeftLevel;
     this.rightLevel = input.RightLevel;
     this.input      = input;
 }
Пример #18
0
 // uses our standardized formatting to return the name for a given input type
 string FormatInputName(ControllerInput inputType)
 {
     return "P" + id.ToString() + "_" + inputType.ToString();
 }
Пример #19
0
        public void ShouldGetExpectedGrabDuration(ControllerInput input, int expectedFrames)
        {
            var data = new GrabDurationProblemData
            {
                Input = input,
                TargetPercent = 20
            };

            var result = _calculator.GrabDuration(data);
            Assert.That(result, Is.EqualTo(expectedFrames));
        }
Пример #20
0
    //Function called from PlayerStartingPositin.Awake to set the player ship controller IDs
    public void SetPlayerShipID(Players playerID_)
    {
        //Setting this ship's controller to the given ID
        this.playerController = playerID_;

        //Getting our controller input based on which player this is
        switch (playerID_)
        {
        case Players.P1:
            this.gameObject.SetActive(true);
            p1ShipRef            = this;
            this.ourController   = ControllerInputManager.P1Controller;
            this.ourCustomInputs = CustomInputSettings.globalReference.p1Inputs;
            this.GetComponent <CameraWeight>().playerThatCanFollow = Players.P1;
            this.ourRailMovement.railParentObj.GetComponent <CameraWeight>().playerThatCanFollow = Players.P1;
            this.GetComponent <CustomShipTextures>().SetPlayerShipID(Players.P1);
            this.shipShield.objectIDType = AttackerID.Player1;
            break;

        case Players.P2:
            this.gameObject.SetActive(true);
            p2ShipRef            = this;
            this.ourController   = ControllerInputManager.P2Controller;
            this.ourCustomInputs = CustomInputSettings.globalReference.p2Inputs;
            this.GetComponent <CameraWeight>().playerThatCanFollow = Players.P2;
            this.ourRailMovement.railParentObj.GetComponent <CameraWeight>().playerThatCanFollow = Players.P2;
            this.GetComponent <CustomShipTextures>().SetPlayerShipID(Players.P2);
            this.shipShield.objectIDType = AttackerID.Player2;

            //If this ship was set as the p1 ship reference, we remove it
            if (p1ShipRef == this)
            {
                p1ShipRef = null;
            }
            break;

        default:
            this.gameObject.SetActive(true);
            p1ShipRef            = this;
            this.ourController   = ControllerInputManager.P1Controller;
            this.ourCustomInputs = CustomInputSettings.globalReference.p1Inputs;
            this.GetComponent <CameraWeight>().playerThatCanFollow = Players.P1;
            this.ourRailMovement.railParentObj.GetComponent <CameraWeight>().playerThatCanFollow = Players.P1;
            this.GetComponent <CustomShipTextures>().SetPlayerShipID(Players.P1);
            this.shipShield.objectIDType = AttackerID.Player1;
            break;
        }

        //Looping through all of our weapons, wings and engines to tell them what player ID we are
        if (this.playerController == Players.P1)
        {
            this.mainWeapon.objectIDType      = AttackerID.Player1;
            this.secondaryWeapon.objectIDType = AttackerID.Player1;
            this.shipCockpit.objectIDType     = AttackerID.Player1;
        }
        else
        {
            this.mainWeapon.objectIDType      = AttackerID.Player2;
            this.secondaryWeapon.objectIDType = AttackerID.Player2;
            this.shipCockpit.objectIDType     = AttackerID.Player2;
        }
        foreach (ShipWingLogic wing in this.shipWings)
        {
            if (this.playerController == Players.P1)
            {
                wing.objectIDType = AttackerID.Player1;
            }
            else if (this.playerController == Players.P2)
            {
                wing.objectIDType = AttackerID.Player2;
            }
        }
        foreach (ShipEngineLogic engine in this.shipEngines)
        {
            if (this.playerController == Players.P1)
            {
                engine.objectIDType = AttackerID.Player1;
            }
            else if (this.playerController == Players.P2)
            {
                engine.objectIDType = AttackerID.Player2;
            }
        }
    }
Пример #21
0
    // Use this for initialization
    void Start()
    {
        controllerInput = new ControllerInput(0, 0.19f);

        //
    }
Пример #22
0
 protected internal virtual bool ControllerButtonPressed(ControllerInput input) => false;