void Start() { dashDetector = GameObject.FindGameObjectWithTag ("weaponPrefab"); playerState = GetComponent <MasterPlayerStateScript>(); stamina = GetComponent<Stamina> (); floor = GameObject.FindGameObjectWithTag ("Floor"); //playerCollider = GetComponent<CharacterController> (); }
void Awake() { //References rigidbody = GetComponent<Rigidbody>(); transform = GetComponent<Transform>(); collider = GetComponent<Collider>(); stamina = GetComponent<Stamina>(); grapple = GetComponent<GrappleHook>(); //Pre-Calculations distToGround = collider.bounds.extents.y; maxSpeed = walkSpeed; }
public SpecialLevel(int roomNumber, string name, bool saved = false) { drawSaveText = saved; firstTime = true; //Adding the player and grid player = new Player(Vector3.Zero); player.Parent = this; tileGrid = LoadLevel(name); tileGrid.Parent = this; gameObjects.Add(tileGrid); player.LoadContent(); gameObjects.Add(player); //Setting the roomcounter roomCounter = new TextGameObject("text"); roomCounter.text = roomNumber.ToString(); //Adding the hanging man if (roomCounter.text == "100") { BillBoard man = new BillBoard(new Vector3(700, 210, 200)); man.Parent = this; gameObjects.Add(man); } if (drawSaveText) { saveText = new TextGameObject("text"); saveText.text = "Progress Saved"; saveText.Position = new Vector2((GameEnvironment.Screen.X - saveText.Size.X) / 2, 0); } if (name == "Content\\Special Levels\\Final.txt") exitText.text = "Press E to kill yourself"; else exitText.text = "Press E to proceed"; //Adding the roomcounter gameObjects.Add(roomCounter); //Adding stamina stamina = new Stamina(); stamina.Parent = this; gameObjects.Add(stamina); }
public MultipleExitLevel(int roomNumber = 1) { part = 0; CreateGrids(); Add(grids[part]); Add(player); completed = false; firstTime = true; player.Grid = grids[part]; stamina = new Stamina(); stamina.Parent = this; gameObjects.Add(stamina); exitText.text = "Press E to proceed"; roomCounter = new TextGameObject("text"); roomCounter.text = roomNumber.ToString(); gameObjects.Add(roomCounter); }
private void Start() { sScripti = GameObject.FindGameObjectWithTag("Player").GetComponent <Stamina>(); staminaBarKuva = GetComponent <Image>(); maxStamina = sScripti.maxStamina; }
static public bool IsParmittion(Stamina stamina) { return(stamina.quantity > PARMIT_STAMINA); }
public static bool IsParmittion(Stamina stamina) { return stamina.quantity > PARMIT_STAMINA; }
/// <summary> /// Returns the partial star rating of the beatmap, calculated using peak strains from all sections of the map. /// </summary> /// <remarks> /// For each section, the peak strains of all separate skills are combined into a single peak strain for the section. /// The resulting partial rating of the beatmap is a weighted sum of the combined peaks (higher peaks are weighted more). /// </remarks> private double locallyCombinedDifficulty(Colour colour, Rhythm rhythm, Stamina staminaRight, Stamina staminaLeft, double staminaPenalty) { List <double> peaks = new List <double>(); for (int i = 0; i < colour.StrainPeaks.Count; i++) { double colourPeak = colour.StrainPeaks[i] * colour_skill_multiplier; double rhythmPeak = rhythm.StrainPeaks[i] * rhythm_skill_multiplier; double staminaPeak = (staminaRight.StrainPeaks[i] + staminaLeft.StrainPeaks[i]) * stamina_skill_multiplier * staminaPenalty; peaks.Add(norm(2, colourPeak, rhythmPeak, staminaPeak)); } double difficulty = 0; double weight = 1; foreach (double strain in peaks.OrderByDescending(d => d)) { difficulty += strain * weight; weight *= 0.9; } return(difficulty); }
protected override void Awake() { base.Awake(); stamina = GetComponent <Stamina>(); }
void Awake() { fighter = gameObject.GetComponent<Fighter> (); stamina = gameObject.GetComponent<Stamina> (); }
void Start() { s = GetComponent <Stamina>(); runningsound = FindObjectsOfType <ChasingLure>(); }
public void Update(Stamina playerstam, PlayerState currentstate, GameObject Handlocation) { InventoryInput(); int Vertical = 0; int Horizontal = 0; int Running = 0; float CurrentSpeed = 0; Vector3 Tempjumpvec; if (currentstate.GetWalk()) { Vertical += GetInput("forward"); Vertical -= GetInput("backward"); Horizontal += GetInput("right"); Horizontal -= GetInput("left"); } if (currentstate.GetRun() && Vertical > 0) { Running += GetInput("run"); } if (currentstate.GetJump()) { ComputeJump(playerstam); } //if (Input.GetKeyDown(KeyCode.E)) //{ // Debug.Log("HEAD ROT: " + _Headtransform.eulerAngles); // Debug.Log("BODY ROT: " + _transform.eulerAngles); // Debug.Log("CAM ROT: " + GameObject.Find("PlayerCamera").transform.eulerAngles); //} Vector3 RawRotation = RotateCamera(currentstate); //_transform.rotation = //_Headtransform.rotation = //_transform.Rotate(Vector3.right * RawRotation.x); Quaternion NewRot = Quaternion.Euler(new Vector3(RawRotation.x, RawRotation.y, 0)); Quaternion FinalRotation = Quaternion.Lerp(OldRot, NewRot, Time.deltaTime / lerpSmoothingTime); _transform.eulerAngles = new Vector3(0, FinalRotation.eulerAngles.y, 0); _Headtransform.eulerAngles = new Vector3(FinalRotation.eulerAngles.x, FinalRotation.eulerAngles.y, 0); OldRot = NewRot; HorizontalVelocity += GradualMovement(Horizontal, MaxVelocity, MinVelocity, HorizontalVelocity, StartIncrement, StopIncrement); VerticalVelocity += GradualMovement(Vertical, MaxVelocity, MinVelocity, VerticalVelocity, StartIncrement, StopIncrement); // Debug.Log("AFTER" + VerticalVelocity); //Reduces diagonal speed if A/D + W/S are pressed together CurrentSpeed = Vertical != 0 && Horizontal != 0 ? Speed / 2 : Speed; CurrentSpeed = (Running > 0) && IsJumping == false?CurrentSpeed *playerstam.DecreaseStam(Time.deltaTime) : CurrentSpeed; if (Running == 0 && !IsJumping) { playerstam.IncreaseStam(Time.deltaTime, Mathf.Abs(Vertical) + Mathf.Abs(Horizontal)); } HorizontalVelocity = CheckVelocity(HorizontalVelocity); VerticalVelocity = CheckVelocity(VerticalVelocity); if (Horizontal != 0 || Vertical != 0) { _animator.SetBool("IsWalking", true); } else if (Horizontal != 0 || Vertical != 0) { _animator.SetBool("IsWalking", true); } else { _animator.SetBool("IsWalking", false); } Vector3 VerticalMovement = _Headtransform.forward * VerticalVelocity; Vector3 HorizontalMovement = _Headtransform.right * HorizontalVelocity; Tempjumpvec = Vector3.up * YVelocity * Time.deltaTime; Vector3 MovementFinal = (HorizontalMovement + VerticalMovement) * CurrentSpeed * Time.deltaTime; MovementFinal.y = 0; Vector3 GravityFinal = AdjustedGravityForce * Time.deltaTime; Vector3 Final = MovementFinal + GravityFinal + Tempjumpvec; _controller.Move(Final); }
/// <summary> /// Creating/generating the level itself /// </summary> /// <param name="roomNumber">The number of the room</param> /// <param name="tiles">The size the Mainpath should be, counted in tiles</param> /// <param name="chased">Whether or not the monster is chasing the player</param> public RandomLevel(int roomNumber, int tiles = 12, bool chased = false, int noteID = 0) { //Setting a boolean for the monster this.chased = chased; //Assining the variables tileList = new Dictionary<Point, Tile>(); keyList = new List<Point>(); random = GameEnvironment.Random; //Select the tiles to use int pathType = random.Next(4); if (pathType < 9) pathID = "0" + (pathType + 1); else pathID = "" + (pathType + 1); int wallType = random.Next(4); if (wallType < 9) wallID = "0" + (wallType + 1); else pathID = "" + (wallType + 1); newTile = new EntryTile(pathID); this.tiles = tiles; //Create the startpoint position = Point.Zero; tileList.Add(position, newTile); keyList.Add(position); //Creating the paths CreateMainPath(); for (int i = random.Next(1, (int)Math.Pow(tiles,2/3)); i > 0; i--) CreateSidePath(random.Next(3, 15), chased); //making the tile grid TileGrid tileGrid = Grid; gameObjects.Add(tileGrid); //making the player player = new Player(Vector3.Zero); gameObjects.Add(player); player.Parent = this; player.LoadContent(); foreach(GameObject obj in tileGrid.Objects) { if (obj != null) if(obj.ID == "EntryTile") { player.Position = new Vector3(obj.Position.X, obj.Position.Y + GameObjectGrid.CellHeight, obj.Position.Z); foreach(GameObject tile in tileGrid.Objects) { if (tile != null) { if (tile.Position.X == obj.Position.X + 200 && tile.Position.Z == obj.Position.Z && tile.ID == "PathTile") player.viewAngleX = 0f; if (tile.Position.X == obj.Position.X && tile.Position.Z == obj.Position.Z + 200 && tile.ID == "PathTile") player.viewAngleX = (float)(Math.PI / 2); if (tile.Position.X == obj.Position.X - 200 && tile.Position.Z == obj.Position.Z && tile.ID == "PathTile") player.viewAngleX = (float)(Math.PI); if (tile.Position.X == obj.Position.X && tile.Position.Z == obj.Position.Z - 200 && tile.ID == "PathTile") player.viewAngleX = (float)(Math.PI * 1.5); } } } } //Adding decoration objects TileGrid grid = Find("TileGrid") as TileGrid; for (int x = 0; x < grid.Columns; x++) for (int y = 0; y < grid.Rows; y++) if (grid.Get(x, y) != null) { if (grid.Get(x, y).ID == "WallTile" && GameEnvironment.Random.Next(15) == 0) { try { if (grid.Get(x + 1, y) != null && grid.Get(x + 1, y).ID == "PathTile" && grid.Get(x + 1, y).ID != "DecorationTile") { AddDecoration(grid.Get(x, y).Position, new Vector3(-1, 0, 0)); grid.Add(new DecorationTile(pathID), x + 1, y); } else if (grid.Get(x, y + 1) != null && grid.Get(x, y + 1).ID == "PathTile" && grid.Get(x, y + 1).ID != "DecorationTile") { AddDecoration(grid.Get(x, y).Position, new Vector3(0, 0, -1)); grid.Add(new DecorationTile(pathID), x, y + 1); } else if (grid.Get(x - 1, y) != null && grid.Get(x - 1, y).ID == "PathTile" && grid.Get(x - 1, y).ID != "DecorationTile") { AddDecoration(grid.Get(x, y).Position, new Vector3(1, 0, 0)); grid.Add(new DecorationTile(pathID), x - 1, y); } else if (grid.Get(x, y - 1) != null && grid.Get(x, y - 1).ID == "PathTile" && grid.Get(x, y - 1).ID != "DecorationTile") { AddDecoration(grid.Get(x, y).Position, new Vector3(0, 0, 1)); grid.Add(new DecorationTile(pathID), x, y - 1); } } catch (IndexOutOfRangeException e) { Console.WriteLine(e.StackTrace); } } } //Add the note if (noteID != 0) { NoteObject note = new NoteObject(noteID.ToString()); note.Parent = this; CreateNote(note, tileGrid); gameObjects.Add(note); } //Making the monster if (chased) { monster = new Monster(Grid.Objects); monster.Parent = this; monster.LoadContent(); gameObjects.Add(monster); } //Making the stamina bar stamina = new Stamina(); gameObjects.Add(stamina); stamina.Parent = this; exitText.text = "Press E to proceed"; //Making the room counter roomCounter = new TextGameObject("text"); roomCounter.text = roomNumber.ToString(); gameObjects.Add(roomCounter); }
// Start is called before the first frame update void Start() { d = GetComponent <DresdenController>(); s = d.GetComponent <Stamina>(); animator = d.GetComponent <Anim>(); }
public void FilterExpense(StaminaExpense expense, Stamina stamina) { expense.cost = 0; }
public void YAxisMove(float magnitude) { Rigidbody2d.velocity = new Vector2(Rigidbody2d.velocity.x, speed * magnitude); Stamina.Spend(Time.deltaTime * staminaDrianSpeed); }
public override int GetHashCode() { int hash = 1; if (Id != 0UL) { hash ^= Id.GetHashCode(); } if (PokemonId != 0) { hash ^= PokemonId.GetHashCode(); } if (Cp != 0) { hash ^= Cp.GetHashCode(); } if (Stamina != 0) { hash ^= Stamina.GetHashCode(); } if (StaminaMax != 0) { hash ^= StaminaMax.GetHashCode(); } if (Move1 != 0) { hash ^= Move1.GetHashCode(); } if (Move2 != 0) { hash ^= Move2.GetHashCode(); } if (DeployedFortId.Length != 0) { hash ^= DeployedFortId.GetHashCode(); } if (OwnerName.Length != 0) { hash ^= OwnerName.GetHashCode(); } if (IsEgg != false) { hash ^= IsEgg.GetHashCode(); } if (EggKmWalkedTarget != 0D) { hash ^= EggKmWalkedTarget.GetHashCode(); } if (EggKmWalkedStart != 0D) { hash ^= EggKmWalkedStart.GetHashCode(); } if (Origin != 0) { hash ^= Origin.GetHashCode(); } if (HeightM != 0F) { hash ^= HeightM.GetHashCode(); } if (WeightKg != 0F) { hash ^= WeightKg.GetHashCode(); } if (IndividualAttack != 0) { hash ^= IndividualAttack.GetHashCode(); } if (IndividualDefense != 0) { hash ^= IndividualDefense.GetHashCode(); } if (IndividualStamina != 0) { hash ^= IndividualStamina.GetHashCode(); } if (CpMultiplier != 0F) { hash ^= CpMultiplier.GetHashCode(); } if (Pokeball != 0) { hash ^= Pokeball.GetHashCode(); } if (CapturedCellId != 0UL) { hash ^= CapturedCellId.GetHashCode(); } if (BattlesAttacked != 0) { hash ^= BattlesAttacked.GetHashCode(); } if (BattlesDefended != 0) { hash ^= BattlesDefended.GetHashCode(); } if (EggIncubatorId.Length != 0) { hash ^= EggIncubatorId.GetHashCode(); } if (CreationTimeMs != 0UL) { hash ^= CreationTimeMs.GetHashCode(); } if (NumUpgrades != 0) { hash ^= NumUpgrades.GetHashCode(); } if (AdditionalCpMultiplier != 0F) { hash ^= AdditionalCpMultiplier.GetHashCode(); } if (Favorite != 0) { hash ^= Favorite.GetHashCode(); } if (Nickname.Length != 0) { hash ^= Nickname.GetHashCode(); } if (FromFort != 0) { hash ^= FromFort.GetHashCode(); } if (BuddyCandyAwarded != 0) { hash ^= BuddyCandyAwarded.GetHashCode(); } if (BuddyTotalKmWalked != 0F) { hash ^= BuddyTotalKmWalked.GetHashCode(); } if (DisplayPokemonId != 0) { hash ^= DisplayPokemonId.GetHashCode(); } if (DisplayCp != 0) { hash ^= DisplayCp.GetHashCode(); } if (pokemonDisplay_ != null) { hash ^= PokemonDisplay.GetHashCode(); } return(hash); }
public virtual bool CastIsValid(GameObject player) { Stamina stamina = player.GetComponent <Stamina>(); return(stamina.UseStamina(staminaConsumption)); }
Stamina vidaStamina; //Hace referencia al script de estamina #endregion Fields #region Methods void Awake() { vidaStamina = GameObject.Find("Stamina").GetComponent<Stamina>(); }
public override int GetHashCode() { int hash = 1; if (Id != 0UL) { hash ^= Id.GetHashCode(); } if (PokemonId != global::POGOProtos.Enums.PokemonId.Missingno) { hash ^= PokemonId.GetHashCode(); } if (Cp != 0) { hash ^= Cp.GetHashCode(); } if (Stamina != 0) { hash ^= Stamina.GetHashCode(); } if (StaminaMax != 0) { hash ^= StaminaMax.GetHashCode(); } if (Move1 != global::POGOProtos.Enums.PokemonMove.MoveUnset) { hash ^= Move1.GetHashCode(); } if (Move2 != global::POGOProtos.Enums.PokemonMove.MoveUnset) { hash ^= Move2.GetHashCode(); } if (DeployedFortId.Length != 0) { hash ^= DeployedFortId.GetHashCode(); } if (OwnerName.Length != 0) { hash ^= OwnerName.GetHashCode(); } if (IsEgg != false) { hash ^= IsEgg.GetHashCode(); } if (EggKmWalkedTarget != 0D) { hash ^= EggKmWalkedTarget.GetHashCode(); } if (EggKmWalkedStart != 0D) { hash ^= EggKmWalkedStart.GetHashCode(); } if (Origin != 0) { hash ^= Origin.GetHashCode(); } if (HeightM != 0F) { hash ^= HeightM.GetHashCode(); } if (WeightKg != 0F) { hash ^= WeightKg.GetHashCode(); } if (IndividualAttack != 0) { hash ^= IndividualAttack.GetHashCode(); } if (IndividualDefense != 0) { hash ^= IndividualDefense.GetHashCode(); } if (IndividualStamina != 0) { hash ^= IndividualStamina.GetHashCode(); } if (CpMultiplier != 0F) { hash ^= CpMultiplier.GetHashCode(); } if (Pokeball != global::POGOProtos.Inventory.Item.ItemId.ItemUnknown) { hash ^= Pokeball.GetHashCode(); } if (CapturedCellId != 0UL) { hash ^= CapturedCellId.GetHashCode(); } if (BattlesAttacked != 0) { hash ^= BattlesAttacked.GetHashCode(); } if (BattlesDefended != 0) { hash ^= BattlesDefended.GetHashCode(); } if (EggIncubatorId.Length != 0) { hash ^= EggIncubatorId.GetHashCode(); } if (CreationTimeMs != 0UL) { hash ^= CreationTimeMs.GetHashCode(); } if (NumUpgrades != 0) { hash ^= NumUpgrades.GetHashCode(); } if (AdditionalCpMultiplier != 0F) { hash ^= AdditionalCpMultiplier.GetHashCode(); } if (Favorite != 0) { hash ^= Favorite.GetHashCode(); } if (Nickname.Length != 0) { hash ^= Nickname.GetHashCode(); } if (FromFort != 0) { hash ^= FromFort.GetHashCode(); } if (BuddyCandyAwarded != 0) { hash ^= BuddyCandyAwarded.GetHashCode(); } return(hash); }
public override int GetHashCode() { int hash = 1; if (FortId.Length != 0) { hash ^= FortId.GetHashCode(); } if (TeamColor != 0) { hash ^= TeamColor.GetHashCode(); } if (pokemonData_ != null) { hash ^= PokemonData.GetHashCode(); } if (Name.Length != 0) { hash ^= Name.GetHashCode(); } hash ^= imageUrls_.GetHashCode(); if (Fp != 0) { hash ^= Fp.GetHashCode(); } if (Stamina != 0) { hash ^= Stamina.GetHashCode(); } if (MaxStamina != 0) { hash ^= MaxStamina.GetHashCode(); } if (Type != 0) { hash ^= Type.GetHashCode(); } if (Latitude != 0D) { hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(Latitude); } if (Longitude != 0D) { hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(Longitude); } if (Description.Length != 0) { hash ^= Description.GetHashCode(); } hash ^= modifiers_.GetHashCode(); if (CloseSoon != false) { hash ^= CloseSoon.GetHashCode(); } if (CheckinImageUrl.Length != 0) { hash ^= CheckinImageUrl.GetHashCode(); } if (eventInfo_ != null) { hash ^= EventInfo.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
void Start() { rb = GetComponent <Rigidbody>(); saakoHypata = true; sScripti = GetComponent <Stamina>(); }