public void CalculateThrustPattern(ShipActions actions) { ResetThrusters(); CalculateTargetAngularVelocity(actions); AchieveTargetAngularVelocity(); GenerateLinearThrust(actions); }
public void OnClickRightPurchaseButton() { int prestige = System.Convert.ToInt32(rightPrestigeText.text); ShipActions ship = playerObj.GetComponent <ShipActions>(); ship.prestigevalue -= prestige; UpgradeShip(rightUpgradeName.text); rightPurchasedButton.interactable = false; }
internal void SetMapping(Keys key, ShipActions shipActions) { var existingMappings = _mappings.Where(x=> x.Value == shipActions).ToList(); foreach (var mapping in existingMappings) { _mappings.Remove(mapping.Key); } _mappings[key] = shipActions; }
public void Both_default_controller_properties_return_an_appropriate_controller(Keys key, ShipActions controller1ExpectedActions, ShipActions controller2ExpectedActions) { _keyboardHandler.IsPressed(Arg.Is(key)).Returns(true); var controller1Actions = _controller1.Actions; Assert.AreEqual(controller1ExpectedActions, controller1Actions); var controller2Actions = _controller2.Actions; Assert.AreEqual(controller2ExpectedActions, controller2Actions); }
void OnTriggerEnter2D(Collider2D other) { if (other.name == "Ship") { hit = true; if (ship == null) { ship = GameObject.Find("Ship").transform; } if (sa == null) { sa = ship.GetComponent <ShipActions>(); } } }
// Update is called once per frame void Update() { if (GameObject.Find("Dragon") == null) { GameObject.Find("Ship").transform.Find("Camera").GetComponent <Camera>().orthographicSize = 5; ShipActions ship = playerObj.GetComponent <ShipActions> (); Timer timeClass = playerObj.GetComponent <Timer> (); PlayerPrefs.SetInt(Constants.HULLCURRVALUE, ship.hullcurrent); PlayerPrefs.SetInt(Constants.DYNAMITECURRCOOLDOWN, 0); PlayerPrefs.SetInt(Constants.PRESTIGEEARN, ship.GetCurrentPrestige()); PlayerPrefs.SetFloat(Constants.TIMELEFT, timeClass.GetTimeLeft()); PlayerPrefs.SetInt(Constants.CURRCREWSAVED, ship.crewsaved); //Debug.Log ("ReturnParentLevelTrigger is "+PlayerPrefs.GetInt (Constants.CURRCREWSAVED,0)); SceneManager.LoadScene("Level 1"); } }
public static ShipActions CreateWithControllerBindings() { var actions = new ShipActions(); actions.flipShot.AddDefaultBinding(InputControlType.Action1); actions.special.AddDefaultBinding(InputControlType.Action2); actions.boost.AddDefaultBinding(InputControlType.Action3); actions.warp.AddDefaultBinding(InputControlType.Action4); actions.grind.AddDefaultBinding(InputControlType.RightTrigger); actions.join.AddDefaultBinding(InputControlType.Action1); actions.start.AddDefaultBinding(InputControlType.Start); actions.up.AddDefaultBinding(InputControlType.LeftStickUp); actions.down.AddDefaultBinding(InputControlType.LeftStickDown); actions.left.AddDefaultBinding(InputControlType.LeftStickLeft); actions.right.AddDefaultBinding(InputControlType.LeftStickRight); return(actions); }
void OnTriggerEnter2D(Collider2D other) { if (other.name.StartsWith("Ship")) { sa = GameObject.Find("Ship").transform.GetComponent <ShipActions>(); sa.shocknow = true; sa.hullcurrent -= getEnemyDamageValue(); transform.gameObject.GetComponent <Renderer> ().material.color = Color.cyan; if (stopAfterShock) { EnemyMoveForward emf = transform.GetComponent <EnemyMoveForward>(); emf.stop = true; } edh.health = 0; shocked = true; } }
void OnTriggerEnter2D(Collider2D other) { ShipActions ship = playerObj.GetComponent <ShipActions> (); //Debug.Log ("EnemyDragonFightTrigger bf PlayerPrefs.GetInt(Constants.DEFEATDRAGON,0)="+PlayerPrefs.GetInt(Constants.DEFEATDRAGON,0)); if (other.name.StartsWith("Ship") && PlayerPrefs.GetInt(Constants.DEFEATDRAGON, 0) == 0) { camera = GameObject.Find("Ship").transform.Find("Camera").GetComponent <Camera>(); camera.orthographicSize = 8; Timer timeClass = playerObj.GetComponent <Timer> (); PlayerPrefs.SetInt(Constants.HULLCURRVALUE, ship.hullcurrent); PlayerPrefs.SetInt(Constants.DYNAMITECURRCOOLDOWN, 0); PlayerPrefs.SetInt(Constants.PRESTIGEEARN, ship.GetCurrentPrestige()); PlayerPrefs.SetFloat(Constants.TIMELEFT, timeClass.GetTimeLeft()); PlayerPrefs.SetInt(Constants.CURRCREWSAVED, ship.crewsaved); PlayerPrefs.SetInt(Constants.DEFEATDRAGON, 1); //Debug.Log ("EnemyDragonFightTrigger af PlayerPrefs.GetInt(Constants.DEFEATDRAGON,0)="+PlayerPrefs.GetInt(Constants.DEFEATDRAGON,0)); enabled = false; SceneManager.LoadScene("DragonFight"); } }
private void UpgradeShip(string text) { ShipActions ship = playerObj.GetComponent <ShipActions>(); if (text.Equals(Constants.HULL)) { ship.hulllevel++; } else if (text.Equals(Constants.DYNAMITE)) { ship.dynamitelevel++; } else if (text.Equals(Constants.PORTFIRERATE)) { ship.portcannonfireratelevel++; } else if (text.Equals(Constants.PORTPOWER)) { ship.portcannonpowerlevel++; } else if (text.Equals(Constants.STARBOARDFIRERATE)) { ship.starboardcannonfireratelevel++; } else if (text.Equals(Constants.STARBOARDPOWER)) { ship.starboardcannonpowerlevel++; } else if (text.Equals(Constants.TOOLBOX)) { ship.toolboxlevel++; } else if (text.Equals(Constants.WHEEL)) { ship.wheellevel++; } }
void Start() { sa = GameObject.Find("Ship").transform.GetComponent <ShipActions>(); //PlayerPrefs.SetInt (Constants.DEFEATDRAGON, 0);//TODO }
// Use this for initialization void Start() { ship = playerObj.GetComponent <ShipActions>(); }
private void GenerateLinearThrust(ShipActions actions) { var linearTarget = 0f; if (actions.HasFlag(ShipActions.Thrust)) { linearTarget += 1f; } if (actions.HasFlag(ShipActions.ReverseThrust)) { linearTarget -= 1f; } if (linearTarget > 0f) { _frontLeftThruster.Throttle += linearTarget; _frontRightThruster.Throttle += linearTarget; } else if (linearTarget < 0f) { _backLeftThruster.Throttle += 0f - linearTarget; _backRightThruster.Throttle += 0f - linearTarget; } }
private void CalculateTargetAngularVelocity(ShipActions actions) { _angularVelocityTarget = 0; if (actions.HasFlag(ShipActions.TurnLeft)) { _angularVelocityTarget -= RotationSpeed; } if (actions.HasFlag(ShipActions.TurnRight)) { _angularVelocityTarget += RotationSpeed; } }
void Start() { sa = GameObject.Find("Ship").transform.GetComponent <ShipActions>(); }
// Use this for initialization void Start() { currCrewSaveOnIsland = 0; SetMainSelected(); ship = playerObj.GetComponent <ShipActions>(); }
// Use this for initialization void Start() { timer = playerObj.GetComponent <Timer>(); ship = playerObj.GetComponent <ShipActions>(); }
// Use this for initialization void Start() { //storeSelected = ES.firstSelectedGameObject; ship = playerObj.GetComponent <ShipActions>(); }
void Start() { actions = ShipActions.CreateWithControllerBindings(); }
// Use this for initialization void Start() { timer = playerObj.GetComponent <Timer>(); shipAction = playerObj.GetComponent <ShipActions>(); storeSelected = retryBtn; }