public MainViewModel() { CvInvoke.UseOpenCL = false; _playerState = PlayerStates.Stopped; _stopwatch = new Stopwatch(); _baseFileAccessor = new VideoCloudPointsFileAccessor(); }
void OnMarioShrinkFinish() { PauseAllAnimations = false; PlayerState = PlayerStates.Small; TransformMarioToNewSize(); UnpauseMario(); PauseControl = false; theLevelManager.invincible = true; }
void Start() { isClimbing = false; climbSpeed = 0; controller = GetComponent <Controller2D>(); gravity = -(2 * jumpHeight) / Mathf.Pow(timeToJumpApex, 2); jumpVelocity = Mathf.Abs(gravity) * timeToJumpApex; playerState = PlayerStates.grounded; }
public void Spawn(GameObject player) { playerState = player.GetComponent <PlayerStates>(); SetPosition(ref player); powderStates.currentState = GunpowderStates.PowderState.Held; playerState.playerState = PlayerStates.PlayerState.pGunpowder; PickedUpComponents(ref playerState, rb, this.gameObject); }
private void PlayerStateDataOnStateExit(PlayerStates state) { if (state != PlayerStates.EXTRACTING) { return; } lineRenderer.enabled = false; }
protected void ChangeState(PlayerStates State) { if (!StateEquals(State)) { currentAnimation.frames = animations[State].Key; currentAnimation.goalTime = animations[State].Value; currentAnimation.currentFrame = 0; playerState = State; } }
void Refill(GameObject col) { playerState = col.GetComponent <PlayerStates>(); if (playerState.FuelInJetpack <= 0) { playerState.FuelInJetpack = playerState.FuelInJetpackMax; HideObject(); Invoke("UnhideObject", reactivateTime); } }
// Called when the local player clicks on the 'lock in' button void LockChampion() { playerState = PlayerStates.lockedIn; titleText.text = LocalisationManager.instance.GetValue("champ_select_title_waiting"); lockinButton.interactable = false; lockedIn = true; Transform container = GetLocalPlayerContainer(); container.GetComponent <ChampionLock>().LockIn(selectedChampion); }
// Use this for initialization void Start () { //Assign the players rigidbody. r = this.GetComponent<Rigidbody> (); if (lockCursor) { Cursor.lockState = CursorLockMode.Locked; Cursor.visible = false; } //get easy, readable reference to playerstates. p = PlayerStates.instance; }
private void Jump() { anim.SetBool("midair", true); anim.SetBool("climbing", false); anim.SetBool("hanging", false); state = PlayerStates.None; didSomethingDurningFrame = true; ReleaseDraggedObject(); currentVelocity.y = jumpForce; }
void Start() { _states = player.GetComponent <PlayerStates>(); Vector3 newPos = playerShip.transform.position; newPos.z = transform.position.z; transform.position = newPos; }
private void CompleteAction(PlayerStates player) { player.playerState = PlayerStates.PlayerState.pEmpty; GameObject interactable = player.GetComponentInChildren <InteractableObjs>().gameObject; player.itemHeld.SetActive(false); player.itemHeld = null; RotateShoulders(player.transform.GetChild(0).GetChild(0), player); interactable.SetActive(false); }
private void GetBig() { playerState = PlayerStates.grow; transform.localScale = bigSize; playerController.speed = bigSpeed; Debug.Log("Player growing"); Debug.Log("Max HP ++"); }
public void BeginPlay() { myCurrentState = PlayerStates.PLAYING; SetCurrentFunds(_runStartFunds * GetLevel()); pc.Propel(initialForce); audioSource.clip = launch; audioSource.Play(); handleInput = true; CoroutineManager.BeginCoroutine(CheckAchievementsRoutine(), ref cr_AchievementChecker, this); }
public void CastArcaneBolt() { this.PlayerState = PlayerStates.Attack; if (CurrentManaPool >= 8f) { this.GetComponent <ArcaneBoltSpawner>().SpawnTheObject(this.gameObject); CastSpell(8f); } //This should pass through the reference of ArcaneBolt set in SpawnedObject to the SetupSpawnObject function }
// Use this for initialization void Start() { instance = this; onNewGameStart(); currentState = PlayerStates.CheckMatch; audioController = GameObject.Find("AudioController").GetComponent <AudioController> (); gameManager = GameObject.Find("GameManager").GetComponent <GameManager> (); comboCount = 0; //checkForMatch (); }
public void WasHit(Vector3 enemyPos) { if (playerCurrentState != PlayerStates.Dead && playerCurrentState != PlayerStates.Hit && playerCurrentState != PlayerStates.None && Time.timeSinceLevelLoad >= hitTime + stunTime + immunityTime) { playerCurrentState = PlayerStates.Hit; hittingMonster = enemyPos; } Debug.Log("Was hit!"); }
private void Awake() { player = ReInput.players.GetPlayer(playerId); m_SpeedFactor.SetValue(m_RunSpeed.Value); refSpeed = m_SpeedFactor.Value; m_PlayerStates = GetComponent <PlayerStates> (); layerMask = LayerMask.GetMask("Ground"); cController = GetComponent <CharacterController> (); m_PlayerAnimation = GetComponent <PlayerAnimation> (); }
//----------------------------------- void Start() { timeManager = GameObject.FindGameObjectWithTag("GamePlayHandler").GetComponent <TimeManager>(); player = transform.root.gameObject; // Gets the root ref reflectFXParticle = reflectFX.GetComponent <ParticleSystem>(); playerState = this.GetComponentInParent <PlayerStates>(); }
void Start() { m_iTurretsPlaced = 0; m_iCurrentlyPlacing = 0; m_goCurrentlyPlacing = m_goPossibleTurrets[0]; m_ePlayerState = PlayerStates.DEFAULT; m_iMaxTurretsPlaceable = 50; m_goPlacedTurrets = new GameObject[m_iMaxTurretsPlaceable]; m_goPlacementDefault = m_goTurretPlacementOk[m_iCurrentlyPlacing]; }
private void BtnStop_Click(object sender, EventArgs e) { player.controls.stop(); btnPlay.BackgroundImage = Properties.Resources.play2; Paused = true; lblMediaName.Text = STOPPED; tmrPlayTick.Enabled = false; txtCurrentTime.Text = ZERO_TIME; State = PlayerStates.Stopped; }
private void Start() { playerStates = GetComponent <PlayerStates>(); rb = GetComponent <Rigidbody>(); speed = baseSpeed; Cursor.lockState = CursorLockMode.Locked; Cursor.visible = false; }
public void GetHit(Vector3 attackPosition) { PlayerStates playerStates = GetComponent <PlayerStates>(); if (playerStates.isAlive) { GetComponent <PlayerStates>().TakeDamage(); //HitEffect } }
// Start is called before the first frame update void Start() { _spriteRenderer = GetComponent <SpriteRenderer>(); _state = GetComponentInParent <PlayerStates>(); _spriteHeight = _spriteRenderer.bounds.size.y; _spriteWidth = _spriteRenderer.bounds.size.x; _resourceLayer = LayerMask.GetMask("resource"); _animText = collectText.GetComponent <TextMeshProUGUI>(); _animTextAnimator = collectText.GetComponent <Animator>(); }
void DropObject() { if (carriedObject != null) { carriedObject.GetComponent <PickUp>().state = PickUp.PickUpStates.CanPickUp; carriedObject.transform.parent = null; carriedObject = null; state = PlayerStates.Normal; } }
public void Initialize() { CurrentSpeed = InitialSpeed; transform.position = _originalPosition; _state = PlayerStates.OnGround; if (_weapon != null) { _weapon.Initialize(); } }
IEnumerator CharacterBehaviour() { while (states != PlayerStates.dead) { dpad = VCDPadBase.GetInstance("dpad"); if (isBoss && !lifeBar) { lifeBar = GameObject.Find("BossLifeFill").GetComponent <tk2dSlicedSprite>(); actorName = GameObject.Find("BossName").GetComponent <tk2dTextMesh>(); actorName.text = characterName; actorName.Commit(); } LifeBarStatus(); if (isPlayer) { switch (states) { case PlayerStates.idle: Idle(dpad); break; case PlayerStates.walk: Walk(dpad); break; case PlayerStates.jump: Jumping(false); break; case PlayerStates.grab: if (grabbedZone.childCount == 0) { player.Play("Idle"); states = PlayerStates.idle; } break; case PlayerStates.jumpattack: Jumping(true); break; case PlayerStates.ko: KO(koOthers); break; } } else { switch (states) { case PlayerStates.idle: Idle(playerPos); break; case PlayerStates.walk: Walk(playerPos); break; case PlayerStates.jump: Jumping(false); break; case PlayerStates.jumpattack: Jumping(true); break; case PlayerStates.ko: KO(koOthers); break; } } yield return(null); } StartCoroutine("Dead"); }
void StateBasicMovement() { if (Input.GetKey(KeyCode.W) && footSteps.isPlaying == false) { footSteps.Play(); } if (Input.GetKey(KeyCode.A) && footSteps.isPlaying == false) { footSteps.Play(); } if (Input.GetKey(KeyCode.S) && footSteps.isPlaying == false) { footSteps.Play(); } if (Input.GetKey(KeyCode.D) && footSteps.isPlaying == false) { footSteps.Play(); } //Debug.Log (playerController.isGrounded); if (zeroGravity == true) { curState = PlayerStates.jetPack; } // check to see if the isOnPlatform is Checked if (isOnPlatform == true) { curState = PlayerStates.idle; } if (Input.GetKeyUp(KeyCode.W)) { footSteps.Stop(); curState = PlayerStates.idle; } if (Input.GetKeyUp(KeyCode.S)) { footSteps.Stop(); curState = PlayerStates.idle; } if (Input.GetKeyUp(KeyCode.D)) { footSteps.Stop(); curState = PlayerStates.idle; } if (Input.GetKeyUp(KeyCode.A)) { footSteps.Stop(); curState = PlayerStates.idle; } if (canClimb == true && Input.GetKeyDown(KeyCode.E)) { curState = PlayerStates.climbing; } }
public void AlterResources() { PlayerStates states = new PlayerStates (); int originalResources = states.resources; states.alterResources (-10); int newResources = states.resources; Assert.Less (newResources, originalResources); states.alterResources (10); Assert.AreEqual (states.resources, originalResources); }
public void ChangePlayerState(PlayerStates state) { if (_player == null) { return; } var playerState = _stateFactory.CreateState(state); _player.ChangeState(playerState); }
public void ChangeState(PlayerStates state) { if (_state != null) { _state.Dispose(); _state = null; } Debug.Log("Changing to player state : " + state.ToString()); _state = _stateFactory.CreateState(state); _state.Start(); }
public void ChangeState(PlayerStates state) { if (_state != null) { _state.Dispose(); _state = null; } _state = _stateFactory.CreateState(state); _state.Start(); }
private void Jump() { if (IsPlayerOnGround && _landed) { PlayerStates.UnSet(PlayerStates.AnimationParameter.Running); PlayerStates.Set(PlayerStates.AnimationParameter.Jump); PlayerStates.Set(PlayerStates.AnimationParameter.Jumping); Vector2 jumpVelocityVector = new Vector2(0, PhysicsHelper.GetVelocityToReachHeight(_jumpHeight)); _rigidBody.velocity = jumpVelocityVector; } }
public Player() { Position = new Vector2(); State = PlayerStates.Running; runAnimation = new SpriteAnimation(); jumpAnimation = new SpriteAnimation(); slidingAnimation = new SpriteAnimation(); swordAnimation = new SpriteAnimation(); dieAnimation = new SpriteAnimation(); punchAnimation = new SpriteAnimation(); immunity = 100; scale = 1f; speedX = 0; }
public bool validateNewAction(PlayerActions newAction) { FSMState result = getCurrentState(); PlayerStates newState = result.validateNewAction(newAction); if(newState.Equals(PlayerStates.NULL)) { return false; } else { currentState=newState; return true; } }
void OnTriggerEnter2D(Collider2D other) { if (other.tag.Contains ("Wall")) { //player hit wall switch (state) { case PlayerStates.MovingLeft: if (other.Equals (LeftWall)) state = PlayerStates.StopedLeft; break; case PlayerStates.MovingRight: if (other.Equals (RightWall)) state = PlayerStates.StopedRight; break; } } else if (other.tag.Contains ("ScoreLine")) { gameController.IncrementScore(); } else if (other.tag.Contains ("Obsticle")){ // Player hit obsticles GameController.paused = true; } }
public void PlayerPickedUpByIcydactyl(object icydactylObj) { AttachedTo = (ActiveObject)icydactylObj; State = PlayerStates.Carried; }
void SetOnFire() { Velocity.X = PLAYER_SPEED * 2; LastOnFire = Game1.CurrentTime; State = PlayerStates.OnFire; }
void KnockBackInDirection(int dir, float strength) { Velocity.X = dir * KNOCKBACK_SPEED * strength; Velocity.Y = -KNOCKBACK_SPEED / 2 * strength; State = PlayerStates.KnockBack; }
public void SwarmPlayer(object swarmObj) { if (State == PlayerStates.Standing || State == PlayerStates.Walking || State == PlayerStates.Shooting) { State = PlayerStates.Swarmed; ShakeCount = MAX_SHAKES_TILL_RELEASE; Velocity = Vector2.Zero; } }
public bool ShootAtObject(ActiveObject obj) { if (!obj.CanBeShot) return false; // Check distance float distance = obj.DrawBox.Center.Distance(DrawBox.Center); if (distance < ShootRange) { if (State == PlayerStates.Walking) Stop(); if (State == PlayerStates.Standing || State == PlayerStates.Shooting) { ShootTarget = obj; State = PlayerStates.Shooting; Game1.EventMan.Notify(Events.PlayerShootsObj, new ActiveObject[] { this, obj }); return true; } } return false; }
public void PlayerHitByRockguy(object rockguyObj) { if (State == PlayerStates.Standing || State == PlayerStates.Walking || State == PlayerStates.Shooting) { // Knockback Rockguy rockguy = (Rockguy)rockguyObj; State = PlayerStates.KnockBack; Velocity.X = KNOCKBACK_SPEED * rockguy.Direction * 2; HPDown(rockguy.DAMAGE); } }
public void PlayerHitByPlant(object snappingPlanetObj) { if (State == PlayerStates.Standing || State == PlayerStates.Walking || State == PlayerStates.Shooting) { // Knockback State = PlayerStates.KnockBack; Velocity.X = KNOCKBACK_SPEED * 0.25f * -Direction; //HPDown(1); } }
public void PlayerFlattened(object boombaObj) { // PlayerFlattened if (State == PlayerStates.Standing || State == PlayerStates.Walking || State == PlayerStates.Shooting) { State = PlayerStates.Flattened; Velocity = Vector2.Zero; LastFlattened = Game1.CurrentTime; HPDown(FLATTENED_DAMAGE); } }
public void MoveTo(Vector2 target) { if (State == PlayerStates.Standing || State == PlayerStates.Walking || State == PlayerStates.Shooting) { TargetDestination = target; State = PlayerStates.Walking; Audio.Play(SFX.Walking); } }
void Awake() { playerStates = GameObject.FindWithTag("Player").GetComponent<PlayerStates>(); }
public void PlayerReleasedByIcydactyl(object nothing) { State = PlayerStates.Standing; }
public void PlayerHitIceColumn(object iceColumnObj) { IceColumn iceColumn = (IceColumn)iceColumnObj; if (State == PlayerStates.Standing || State == PlayerStates.Walking || State == PlayerStates.Shooting) { float bounceSpeedX = KNOCKBACK_SPEED; if (DrawBox.Center.X < iceColumn.DrawBox.Center.X) { // Bounce left and freeze bounceSpeedX *= -1; } Velocity.X = bounceSpeedX; Velocity.Y = -KNOCKBACK_SPEED * 0.2f; Position.Y -= 20; State = PlayerStates.Frozen; LastFrozen = Game1.CurrentTime; } }
public void Shake(object nothing) { if (State == PlayerStates.Swarmed) { if (--ShakeCount <= 0) { ShakeCount = 0; if (State == PlayerStates.Swarmed) { State = PlayerStates.Standing; Game1.EventMan.Notify(Events.ShakeReleased, this); } } } }
public void PlayerHitSpikes(object spikes) { SpikeWall spikeWall = (SpikeWall)spikes; if (State == PlayerStates.Standing || State == PlayerStates.Walking || State == PlayerStates.Shooting || State == PlayerStates.KnockBack) { // Resolve Collision Rectangle overlap = Rectangle.Intersect(spikeWall.Hitbox, Hitbox); if (DrawBox.Center.X > spikeWall.DrawBox.Center.X) Position.X += overlap.Width; else Position.X -= overlap.Width; // Knockback State = PlayerStates.KnockBack; Velocity.X = KNOCKBACK_SPEED * 0.25f * -Direction; HPDown(spikeWall.DAMAGE); } }
public void StopShooting() { if (State == PlayerStates.Shooting) { State = PlayerStates.Standing; LastShotAtSomething = Game1.CurrentTime; } }
public void PlayerHitWithIcicle(object icicleObj) { if (State == PlayerStates.Standing || State == PlayerStates.Walking || State == PlayerStates.Shooting) { // Knockback State = PlayerStates.KnockBack; Velocity.X = KNOCKBACK_SPEED * 0.25f * -Direction; IceCloud.Icicle icicle = (IceCloud.Icicle)icicleObj; HPDown(icicle.DAMAGE); } }
public override void Update(GameTime gameTime) { float timeDelta = (float)gameTime.ElapsedGameTime.TotalSeconds; switch (State) { case PlayerStates.Standing: Velocity.X = 0; break; case PlayerStates.Walking: EvaluateWalking(timeDelta); break; case PlayerStates.Shooting: EvaluateShooting(); break; case PlayerStates.KnockBack: Velocity.X *= 0.90f; // Horizontal Friction if (Math.Abs(Velocity.X) < KNOCKBACK_SPEED * timeDelta) RestorePlayerState(true); break; case PlayerStates.Electrocuted: if (gameTime.TotalGameTime - LastElectrocuted > ElectrocutionDuration) State = PlayerStates.Standing; break; case PlayerStates.Hugged: Velocity = Vector2.Zero; HPDown(Yeti.HUGGING_DAMAGE); break; case PlayerStates.Carried: Velocity = Vector2.Zero; Position = new Vector2( AttachedTo.DrawBox.X, AttachedTo.DrawBox.Center.Y - 50); break; case PlayerStates.Frozen: if (Game1.CurrentTime - LastFrozen > FreezeRate) RestorePlayerState(false); Velocity.X *= 0.95f; break; case PlayerStates.Flattened: if (Game1.CurrentTime - LastFlattened > FlattenedCoolDown) RestorePlayerState(false); break; case PlayerStates.OnFire: // Don't change direction intially if (Game1.CurrentTime - LastOnFireDirectionChange > OnFireFirstDirectionChangeRate) { if (Game1.CurrentTime - LastOnFireDirectionChange > OnFireDirectionChangeRate) { LastOnFireDirectionChange = Game1.CurrentTime; Velocity.X = -Velocity.X; } } HPDown(FIRE_DAMAGE); if (Game1.CurrentTime - LastOnFire > OnFireDuration) RestorePlayerState(false); break; } // Facing Direction, if 0, leave as is if (Velocity.X > 0) Direction = 1; else if (Velocity.X < 0) Direction = -1; // Stop from falling through the ground if (DrawBox.Bottom > World.GroundLevel) Velocity.Y = 0; // Move Position.X += Velocity.X * timeDelta; Position.Y += Velocity.Y * timeDelta; UpdateDrawbox(); if (DrawBox.Center.X < 0) { int difference = 0 - DrawBox.Center.X; Position.X = World.WORLD_WIDTH - DrawBox.Width / 2 - difference; } if (DrawBox.Center.X > World.WORLD_WIDTH) { int difference = World.WORLD_WIDTH - DrawBox.Center.X; Position.X = DrawBox.Width / 2 - difference; UpdateDrawbox(); } }
public void PlayerHitWithLightning(object lightningObj) { if (State == PlayerStates.Walking || State == PlayerStates.Standing || State == PlayerStates.Shooting) { State = PlayerStates.Electrocuted; LastElectrocuted = Game1.CurrentTime; Velocity = Vector2.Zero; StormCloud.Lightning lightning = (StormCloud.Lightning)lightningObj; HPDown(lightning.DAMAGE); } }
void RestorePlayerState(bool changeDir) { switch (NextState) { case PlayerStates.OnFire: SetOnFire(); break; default: State = PlayerStates.Standing; break; } if (changeDir) Direction *= -1; NextState = PlayerStates.Standing; }
public void PlayerHugged(object yetiObj) { Yeti yeti = (Yeti)yetiObj; if (State == PlayerStates.Walking || State == PlayerStates.Standing || State == PlayerStates.Shooting) { State = PlayerStates.Hugged; LastHugged = Game1.CurrentTime; Velocity = Vector2.Zero; Position = new Vector2( yeti.DrawBox.Center.X - yeti.DrawBox.Width / 2, yeti.DrawBox.Center.Y - yeti.DrawBox.Height / 2); } }
void Stop() { State = PlayerStates.Standing; Velocity.X = 0; }
public void PlayerHugRelease(object yetiObj) { if (State == PlayerStates.Hugged) State = PlayerStates.Standing; }
void switchState(PlayerStates newState) { switch (playerState) { case PlayerStates.pregame: preGameExit(); break; case PlayerStates.normal: normalExit(); break; case PlayerStates.swingingMelee: swingingMeleeExit(); break; case PlayerStates.dodging: dodgingExit(); break; case PlayerStates.sliding: slidingExit(); break; case PlayerStates.dead: deadExit(); break; } playerState = newState; switch (playerState) { case PlayerStates.pregame: preGameEnter(); break; case PlayerStates.normal: normalEnter(); break; case PlayerStates.swingingMelee: swingingMeleeEnter(); break; case PlayerStates.dodging: dodgingEnter(); break; case PlayerStates.sliding: slidingEnter(); break; case PlayerStates.dead: deadEnter(); break; } }
// Use this for initialization void Start() { f_RayLength = 5.0f; player = GameObject.FindWithTag("Player").GetComponent<PlayerStates>(); b_IsOn = false; }