// Use this for initialization void Start() { movement = .2f; player = GameObject.FindGameObjectWithTag("Player"); jumpScript = player.GetComponent <Jumping>(); originalPoints = jumpScript.points; }
private void Start() { rb = GetComponent <Rigidbody>(); moveVelocity = new Vector2(0, 0); jumping = new Jumping(); movement = new Movement(); }
public bool ToIdle(Idle idle, Jumping jumping, Crouching crouching, Sliding sliding) { return(idle.IsIdle() && !jumping.IsJumping() && (!crouching.IsCrouching && !crouching.Rising) && !sliding.IsSliding); }
private int playerLayer; // Layer auf dem der Spieler liegt void Start() { // Initialisierungen playerLayer = LayerMask.NameToLayer("Player"); movement = GameObject.Find("Player").GetComponent <Movement>(); jumping = movement.GetComponent <Jumping>(); PlayerInfo.On_Player_Disabled += PlayerDisabled; }
// Start is called before the first frame update void Start() { this.collision = GetComponent <Collision>(); this.grab = GetComponent <Grab>(); this.jumping = GetComponent <Jumping>(); this.rigidbody = GetComponent <Rigidbody2D>(); }
void OnTriggerEnter(Collider col) { if (col.gameObject.tag == "Player") { canDestroy = true; playerjumping = col.gameObject.GetComponent<Jumping> (); } }
public bool ToJump(Jumping jumping, bool isWallRunning, bool isWallJumping) { bool wallJumped = !isWallRunning || isWallJumping; return(jumping.IsJumping() && wallJumped && !FixInitialNotGrounded()); }
void OnTriggerEnter(Collider col) { if (col.gameObject.tag == "Player") { canDestroy = true; playerjumping = col.gameObject.GetComponent <Jumping> (); } }
// Start is called before the first frame update void Start() { stateMachine = new StateMachine(); standing = new Standing(stateMachine); running = new Running(stateMachine); ducking = new Ducking(stateMachine); jumping = new Jumping(stateMachine); walking = new Walking(stateMachine); stateMachine.HandleInput(); }
public void Awake() { controller = GetComponent <ActorController>(); jumper = GetComponent <Jumping>(); animator = GetComponent <Animator>(); rb = GetComponent <Rigidbody2D>(); renderer = GetComponent <Renderer>(); player = GetComponent <Player>(); healthText.text = "Health: " + player.playerStats.health.ToString(); firePoint = transform.FindChild("firePoint"); }
public static void Prefix(Mech __instance) { try { Jumping.InitEffectStats(__instance); } catch (Exception e) { Control.Logger.Error.Log(e); } }
public void Awake() { controller = GetComponent <ActorController>(); jumper = GetComponent <Jumping>(); animator = GetComponent <Animator>(); rb = GetComponent <Rigidbody2D>(); render = GetComponent <Renderer>(); player = GetComponent <Player>(); //healthText.text = "Health: " + player.playerStats.health.ToString(); weaponTransform = weapon.transform; audioSourcePlayer = GetComponent <AudioSource>(); //Audio Stuff }
public static bool Prefix(Mech __instance, ref float __result) { try { __result = Jumping.CalcMaxJumpDistance(__instance); return(false); } catch (Exception e) { Control.Logger.Error.Log(e); } return(true); }
public static bool Prefix(Mech __instance, float distJumped, ref int __result) { try { __result = Jumping.CalcJumpHeat(__instance, distJumped); return(false); } catch (Exception e) { Control.Logger.Error.Log(e); } return(true); }
public override Node SetUp_Tree() { Node idling = new Idling(); Node running = new Running(); Node crouching = new Crouching(); Node jumping = new Jumping(); Node falling = new Falling(); Node nonAttacked = Node_Selector.Create(crouching, running, idling, jumping, falling); Node attacked = new Attacked(); return(Node_Selector.Create(attacked, nonAttacked)); }
void DetectKeys() { if (Input.GetKeyDown(KeyCode.Space)) { Jump?.Invoke(); } if (Input.GetKey(KeyCode.Space)) { Jumping?.Invoke(); } if (Input.GetKeyDown(KeyCode.Escape)) { EscapeKey?.Invoke(); } }
private void _timerProc() { for (; ;) { Thread.Sleep(600 / _steps); if (Next()) { Jumping?.Invoke(this, EventArgs.Empty); } else { break; } } }
public void PlayJump() { var random = 0; for (bool canPass = false; canPass == true;) { random = Random.Range(0, Shouts.Length - 1); if (random != lastShout) { canPass = true; } } Shouts[random].Play(); Jumping.Play(); }
private void DoWillyFall() { // cWILLYy = cWILLYy + 4 _y += 4; // blk1 = GetBlock(cWILLYx, cWILLYy + 16) var block1 = GetBlock(_x, _y + 16); // blk2 = GetBlock(cWILLYx + 8, cWILLYy + 16) var block2 = GetBlock(_x + 8, _y + 16); // If blk1<>0 Or blk2<>0 if (block1 != 0 || block2 != 0) { // cWILLYy = (cWILLYy And 248) _y &= 248; //cWILLYm = 0 _state = 0; // If cWILLYfall>= 32 if (_willyFall >= 32) { // cWILLYm = 6 _state = 6; } else // Else { // cWILLYfall = 0 _willyFall = 0; } // End If } else { // Else // cWILLYfall = cWILLYfall + 4 _willyFall += 4; // End If } // cWILLYjs = (cWILLYjs + 1) Mod 11 _js = (_js + 1) % 11; // SoundPitch SFXjump,16384 - (cWILLYjs * 1000) Position = new Vector2(_x & 248, _y); Jumping.Invoke(this, _js); }
bool Apply(Transform other) { Movement poweredMovement = other.GetComponent <Movement>(); Jumping poweredJumping = other.GetComponent <Jumping>(); if (poweredJumping != null) { poweredJumping.jumpingModifier = modifier; } if (poweredMovement != null) { poweredMovement.speedModifier = modifier; return(true); } return(false); }
void Start() { physicController = GetComponent <EnhancedPhysicController>(); walking = GetComponent <Walking>(); jumping = GetComponent <Jumping>(); dashing = GetComponent <Dashing>(); var movementsInputs = inputs.FindActionMap("Movements"); movementsInputs.Enable(); movementsInputs["MoveForward"].performed += OnMoveForward; movementsInputs["MoveRight"].performed += OnMoveRight; movementsInputs["Jump"].performed += OnJump; movementsInputs["LookAt"].performed += OnLookAt; //movementsInputs["LookAt"].canceled += OnStopLookAt; movementsInputs["Dash"].performed += OnDash; onJumpActions.Add(() => { audioSource.clip = jumpSound; audioSource.Play(); }); onDashActions.Add(() => { audioSource.clip = dashSound; audioSource.Play(); }); }
public void Execute(Player player) { // Put all key checks into State functions - this gets run every frame the state is active - no need for switch if (Input.GetKeyDown(KeyCode.S)) { // Transition to Ducking Ducking duck = new Ducking(); duck.Enter(player); } if (Input.GetKeyDown(KeyCode.W)) { // Transition to Ducking Sprinting sprint = new Sprinting(); sprint.Enter(player); } if (Input.GetKeyDown(KeyCode.Space)) { Jumping jump = new Jumping(); jump.Enter(player); } }
public bool WallRunToSprint(Jumping jumping, bool isWallRunning, bool preserveSprint) { return(!isWallRunning && !jumping.IsJumping() && preserveSprint); }
public bool JumpToWalk(Jumping jumping, Walking walking, bool preserveSprint) { return(!jumping.IsJumping() && !jumping.ToSlide && !preserveSprint && walking.IsWalking()); }
public bool JumpToSprint(Jumping jumping, bool preserveSprint) { return(!jumping.IsJumping() && !jumping.ToSlide && preserveSprint); }
public bool JumpToSlide(Jumping jumping) { return(!jumping.IsJumping() && jumping.ToSlide); }
/// <summary> /// Called before a player jumps. /// </summary> /// <param name="ev">The <see cref="JumpingEventArgs"/> instance.</param> public static void OnJumping(JumpingEventArgs ev) => Jumping.InvokeSafely(ev);
/// <summary> /// When the player is not at ground level and not jumping /// he is brought back down to ground level. /// </summary> private void Falling() { if (PlayerPosition.Y <= levelController.GroundLevel) { PlayerPosition.Y = PlayerPosition.Y + 1; } else { PlayerPosition.Y = levelController.GroundLevel; jumpInMotion = false; jump = Jumping.Stationary; action = PlayerActions.Standing; } }
/// <summary> /// When a jump commences a player moves upwards until he hits /// the predefined jump height (roofHeight). When he reaches this height /// his jumping action is turned to falling. /// </summary> private void PlayerJump() { if (PlayerPosition.Y > levelController.RoofHeight) { PlayerPosition.Y = PlayerPosition.Y - 2; } else { jump = Jumping.Falling; } }
void Awake() { jumping = GetComponent<Jumping>(); moving = GetComponent<Moving>(); }
private void PlayerAttacked() { if (PlayerPosition.Y > levelController.RoofHeight) { PlayerPosition.Y = PlayerPosition.Y - 2; } else { jump = Jumping.Falling; } levelController.Ground.GroundOffset = levelController.Ground.GroundOffset - 5; //if (direction == Direction.Left) //{ // levelController.Ground.GroundOffset = levelController.Ground.GroundOffset - 5; //} //else //{ // levelController.Ground.GroundOffset = levelController.Ground.GroundOffset + 5; //} }
public bool WallRunToWalk(Jumping jumping, Walking walking, bool isWallRunning) { return(!isWallRunning && !jumping.IsJumping() && walking.IsWalking()); }
void Awake() { breeding = GetComponent<Breeding>(); jumping = GetComponent<Jumping>(); moving = GetComponent<Moving>(); }
public static void PopulatePieMenuPickerWithOutfits(CustomPedestal pedestal, Sim actor, out List <ObjectPicker.TabInfo> listObjs, out List <ObjectPicker.HeaderInfo> headers, out int NumSelectableRows, OutfitUtils.GreyedOutOutfitCallback greyed) { if (pedestal == null) { CMShopping.PrintMessage("Pedestal null"); } NumSelectableRows = 1; headers = new List <ObjectPicker.HeaderInfo>(); listObjs = new List <ObjectPicker.TabInfo>(); headers.Add(new ObjectPicker.HeaderInfo("Ui/Caption/ObjectPicker:Outfit", "Ui/Tooltip/ObjectPicker:Outfit")); headers[0].Width = 250; if (actor != null) { SimDescription simDescription = actor.SimDescription; ResourceKey resourceKey = CASUtils.GetOutfitInGameObject(actor.ObjectId); if (simDescription.HasSupernaturalOutfit(resourceKey) && simDescription.CreatedSim != null) { OutfitCategories currentOutfitCategory = simDescription.CreatedSim.CurrentOutfitCategory; int currentOutfitIndex = simDescription.CreatedSim.CurrentOutfitIndex; SimOutfit outfit = simDescription.GetOutfit(currentOutfitCategory, currentOutfitIndex); if (outfit != null && outfit.Key != ResourceKey.kInvalidResourceKey) { resourceKey = outfit.Key; } } ObjectPicker.TabInfo tabInfo = new ObjectPicker.TabInfo("glb_all_r2", Localization.LocalizeString("Ui/Caption/ObjectPicker:All", new object[0]), new List <ObjectPicker.RowInfo>()); string text = Localization.LocalizeString("Ui/Caption/ObjectPicker:Everyday", new object[0]); string text2 = Localization.LocalizeString("Ui/Caption/ObjectPicker:Formalwear", new object[0]); string text3 = Localization.LocalizeString("Ui/Caption/ObjectPicker:Sleepwear", new object[0]); string text4 = null; string text5 = null; string text6 = null; string text7 = null; string text8 = null; string text9 = null; string text10 = null; ObjectPicker.TabInfo tabInfo2 = new ObjectPicker.TabInfo(actor.IsHorse ? "cas_acc_riding" : "shopping_clothing_everyday_r2", text, new List <ObjectPicker.RowInfo>()); ObjectPicker.TabInfo tabInfo3 = new ObjectPicker.TabInfo("shopping_clothing_formal_r2", text2, new List <ObjectPicker.RowInfo>()); ObjectPicker.TabInfo tabInfo4 = new ObjectPicker.TabInfo("shopping_clothing_sleepwear_r2", text3, new List <ObjectPicker.RowInfo>()); ObjectPicker.TabInfo tabInfo5 = null; ObjectPicker.TabInfo tabInfo6 = null; ObjectPicker.TabInfo tabInfo7 = null; ObjectPicker.TabInfo tabInfo8 = null; ObjectPicker.TabInfo tabInfo9 = null; ObjectPicker.TabInfo tabInfo10 = null; ObjectPicker.TabInfo tabInfo11 = null; ObjectPicker.TabInfo tabInfo12 = null; if (simDescription.ToddlerOrAbove) { if (!simDescription.Toddler) { text4 = Localization.LocalizeString("Ui/Caption/ObjectPicker:Swimwear", new object[0]); text5 = Localization.LocalizeString("Ui/Caption/ObjectPicker:Athletic", new object[0]); tabInfo5 = new ObjectPicker.TabInfo("shopping_clothing_swimwear_r2", text4, new List <ObjectPicker.RowInfo>()); tabInfo6 = new ObjectPicker.TabInfo("shopping_clothing_athletic_r2", text5, new List <ObjectPicker.RowInfo>()); } if (GameUtils.IsInstalled(ProductVersion.EP8)) { text10 = Localization.LocalizeString("Ui/Caption/ObjectPicker:Outerwear", new object[0]); tabInfo12 = new ObjectPicker.TabInfo("cas_clothing_i_outerwear", text10, new List <ObjectPicker.RowInfo>()); } } if (simDescription.IsHorse) { text7 = Localization.LocalizeString("Ui/Caption/ObjectPicker:Racing", new object[0]); tabInfo9 = new ObjectPicker.TabInfo("cas_acc_racing", text7, new List <ObjectPicker.RowInfo>()); text8 = Localization.LocalizeString("Ui/Caption/ObjectPicker:Jumping", new object[0]); tabInfo10 = new ObjectPicker.TabInfo("cas_acc_jumping", text8, new List <ObjectPicker.RowInfo>()); text9 = Localization.LocalizeString("Ui/Caption/ObjectPicker:BridleOnly", new object[0]); tabInfo11 = new ObjectPicker.TabInfo("cas_acc_horse_bridles", text9, new List <ObjectPicker.RowInfo>()); } SkillManager skillManager = actor.SkillManager; if (skillManager != null && skillManager.HasElement(SkillNames.MartialArts) && !simDescription.IsVisuallyPregnant) { headers[0].Width += 50; text6 = Localization.LocalizeString("Ui/Caption/ObjectPicker:MartialArts", new object[0]); tabInfo7 = new ObjectPicker.TabInfo("w_simple_martialarts_skill_s", text6, new List <ObjectPicker.RowInfo>()); } if (actor.Occupation != null) { SimOutfit outfit2 = simDescription.GetOutfit(OutfitCategories.Career, 0); if (outfit2 != null) { headers[0].Width += 50; string tabText = Localization.LocalizeString("Ui/Caption/ObjectPicker:Miscellaneous", new object[0]); tabInfo8 = new ObjectPicker.TabInfo("glb_i_options32", tabText, new List <ObjectPicker.RowInfo>()); } } string textLabel = Localization.LocalizeString("Ui/Caption/ObjectPicker:Career", new object[0]); if (!actor.IsFoal) { OutfitPicker.PopulatePieMenuPickerWithCategoryOutfits(pedestal, simDescription, resourceKey, tabInfo, OutfitCategories.Everyday, text, tabInfo2, greyed); } OutfitPicker.PopulatePieMenuPickerWithCategoryOutfits(pedestal, simDescription, resourceKey, tabInfo, OutfitCategories.Formalwear, text2, tabInfo3, greyed); OutfitPicker.PopulatePieMenuPickerWithCategoryOutfits(pedestal, simDescription, resourceKey, tabInfo, OutfitCategories.Sleepwear, text3, tabInfo4, greyed); OutfitPicker.PopulatePieMenuPickerWithCategoryOutfits(pedestal, simDescription, resourceKey, tabInfo, OutfitCategories.Swimwear, text4, tabInfo5, greyed); OutfitPicker.PopulatePieMenuPickerWithCategoryOutfits(pedestal, simDescription, resourceKey, tabInfo, OutfitCategories.Athletic, text5, tabInfo6, greyed); if (tabInfo12 != null) { OutfitPicker.PopulatePieMenuPickerWithCategoryOutfits(pedestal, simDescription, resourceKey, tabInfo, OutfitCategories.Outerwear, text10, tabInfo12, greyed); } OutfitPicker.PopulatePieMenuPickerWithCategoryOutfits(pedestal, simDescription, resourceKey, tabInfo, OutfitCategories.MartialArts, text6, tabInfo7, greyed); OutfitPicker.PopulatePieMenuPickerWithCategoryOutfits(pedestal, simDescription, resourceKey, tabInfo, OutfitCategories.Career, textLabel, tabInfo8, greyed); OutfitPicker.PopulatePieMenuPickerWithCategoryOutfits(pedestal, simDescription, resourceKey, tabInfo, OutfitCategories.Bridle, text9, tabInfo11, greyed); Racing racing = skillManager.GetElement(SkillNames.Racing) as Racing; if (racing != null && racing.HasRacingSaddleOutfit) { OutfitPicker.PopulatePieMenuPickerWithCategoryOutfits(pedestal, simDescription, resourceKey, tabInfo, OutfitCategories.Racing, text7, tabInfo9, greyed); } Jumping jumping = skillManager.GetElement(SkillNames.Jumping) as Jumping; if (jumping != null && jumping.HasJumpOutfit) { OutfitPicker.PopulatePieMenuPickerWithCategoryOutfits(pedestal, simDescription, resourceKey, tabInfo, OutfitCategories.Jumping, text8, tabInfo10, greyed); } listObjs.Add(tabInfo); if (tabInfo2.RowInfo.Count > 0) { listObjs.Add(tabInfo2); } if (tabInfo3.RowInfo.Count > 0) { listObjs.Add(tabInfo3); } if (tabInfo4.RowInfo.Count > 0) { listObjs.Add(tabInfo4); } if (tabInfo5 != null && tabInfo5.RowInfo.Count > 0) { listObjs.Add(tabInfo5); } if (tabInfo6 != null && tabInfo6.RowInfo.Count > 0) { listObjs.Add(tabInfo6); } if (tabInfo12 != null && tabInfo12.RowInfo.Count > 0) { listObjs.Add(tabInfo12); } if (tabInfo7 != null && tabInfo7.RowInfo.Count > 0) { listObjs.Add(tabInfo7); } if (tabInfo11 != null && tabInfo11.RowInfo.Count > 0) { listObjs.Add(tabInfo11); } if (tabInfo9 != null && tabInfo9.RowInfo.Count > 0) { listObjs.Add(tabInfo9); } if (tabInfo10 != null && tabInfo10.RowInfo.Count > 0) { listObjs.Add(tabInfo10); } if (tabInfo8 != null && tabInfo8.RowInfo.Count > 0) { listObjs.Add(tabInfo8); } } }
private static Boolean KawigiEdit_RunTest(int testNum, int p0, int p1, int[] p2, Boolean hasAnswer, string p3) { Console.Write("Test " + testNum + ": [" + p0 + "," + p1 + "," + "{"); for (int i = 0; p2.Length > i; ++i) { if (i > 0) { Console.Write(","); } Console.Write(p2[i]); } Console.Write("}"); Console.WriteLine("]"); Jumping obj; string answer; obj = new Jumping(); DateTime startTime = DateTime.Now; answer = obj.ableToGet(p0, p1, p2); DateTime endTime = DateTime.Now; Boolean res; res = true; Console.WriteLine("Time: " + (endTime - startTime).TotalSeconds + " seconds"); if (hasAnswer) { Console.WriteLine("Desired answer:"); Console.WriteLine("\t" + "\"" + p3 + "\""); } Console.WriteLine("Your answer:"); Console.WriteLine("\t" + "\"" + answer + "\""); if (hasAnswer) { res = answer == p3; } if (!res) { Console.WriteLine("DOESN'T MATCH!!!!"); } else if ((endTime - startTime).TotalSeconds >= 2) { Console.WriteLine("FAIL the timeout"); res = false; } else if (hasAnswer) { Console.WriteLine("Match :-)"); } else { Console.WriteLine("OK, but is it right?"); } Console.WriteLine(""); return res; }
/// <summary> /// controls the movement on the player /// </summary> private void Movement() { // check to see if the player is on solid ground // if he is not then place him into a falling state if (jumpInMotion == false) { if (PlayerPosition.Y != levelController.GroundLevel) { jump = Jumping.Falling; } } if (jump == Jumping.Falling) { Falling(); } if (jumpInMotion == true && jump != Jumping.Falling) { PlayerJump(); } switch (direction) { case Direction.Left: MoveLeft(); break; case Direction.Right: MoveRight(); break; } }
private void Jumperino() { i = 0; jump = true; Jumping.Start(); }
private void DoWillyJump() { _jp = ((_j & 254) - 8) / 2; _y = _y + _jp; if (_j < 8) { var block1 = GetBlock(_x, _y); var block2 = GetBlock(_x + 8, _y); if (block1 == 3 || block2 == 3) { _state = 4; _js = 0; _y = (_y + 8) & 248; } } if (_j > 11) { if ((_y & 7) == 0) { var block1 = GetBlock(_x, _y + 16); var block2 = GetBlock(_x + 8, _y + 16); if (block1 != 0 || block2 != 0) { _state = 0; _j = 0; _y = _y & 248; } } } _j++; if (_j == 18) { _state = 0; _j = 0; CheckWillyFall(); } if (_j < 11) { _js++; } else { if (_j > 10) { _js--; } } if (_j > 12) { _willyFall = _willyFall + _jp; } if (_state != 0) { Jumping.Invoke(this, _js); } }