//Player Listener private void PlayerAction(Player.PlayerAction playerAction) { switch (playerAction) { case Player.PlayerAction.reflect: if (player.rBody.velocity.x != 0) { CamRotation.ReflectRotationSwitch(player, reflectRotationSwitchDuration); } break; case Player.PlayerAction.charge: CamZoom.ZoomToVelocity(player, defaultTransitionDuration); CamRotation.RotateToVelocity(player, defaultTransitionDuration); break; case Player.PlayerAction.decharge: CamRotation.RotateToVelocity(player, defaultTransitionDuration); break; case Player.PlayerAction.teleport: CamMove.StopFollowing(); CamMove.MoveCamTo(Player.destinationPortal.transform.position, player.teleportDuration); break; default: break; } }
public void Fire(Player.PlayerAction action) { GameObject g = Instantiate(bullet, transform.position, Quaternion.identity); g.GetComponent <TelekinesisProjectile>().action = action; switch (controller.faceDir) { case Controller2D.Direction.North: //g.GetComponent<Rigidbody2D>().AddForce(Vector2.up * 5, ForceMode2D.Impulse); g.GetComponent <TelekinesisProjectile>().Cast(90); break; case Controller2D.Direction.South: g.GetComponent <TelekinesisProjectile>().Cast(270); //g.GetComponent<Rigidbody2D>().AddForce(Vector2.down * 5, ForceMode2D.Impulse); break; case Controller2D.Direction.East: g.GetComponent <TelekinesisProjectile>().Cast(0); //g.GetComponent<Rigidbody2D>().AddForce(Vector2.right * 5, ForceMode2D.Impulse); break; case Controller2D.Direction.West: g.GetComponent <TelekinesisProjectile>().Cast(180); //g.GetComponent<Rigidbody2D>().AddForce(Vector2.left * 5, ForceMode2D.Impulse); break; } }
public void Load(Player.PlayerAction action, Player.PlayerFacing facing) { if (action == Player.PlayerAction.Walking || action == Player.PlayerAction.Sneaking) { if (facing == Player.PlayerFacing.Front) { front.Load(); } if (facing == Player.PlayerFacing.Back) { back.Load(); } if (facing == Player.PlayerFacing.Left) { left.Load(); } if (facing == Player.PlayerFacing.Right) { right.Load(); } } if (action == Player.PlayerAction.Attacking) { if (facing == Player.PlayerFacing.Front) { attackFront.Load(); } if (facing == Player.PlayerFacing.Back) { attackBack.Load(); } if (facing == Player.PlayerFacing.Left) { attackLeft.Load(); } if (facing == Player.PlayerFacing.Right) { attackRight.Load(); } } }
public void Update() { startTime = game.startTime; renderFreq = (float)game.RenderFrequency; updateFreq = (float)game.UpdateFrequency; gameTime = game.time; amountChunksGenerated = game.world.GetAmountChunksGenerated(); chunkPlayerIsIn = game.world.GetChunkAtPlayer(); player = game.world.player; playerLoc = player.GetLocation(); playerAction = player.GetAction(); playerFacing = player.GetFacing(); garbage1 = GC.CollectionCount(1); garbage2 = GC.CollectionCount(2); garbage3 = GC.CollectionCount(3); }
public void TriggerQuest(Player player, Player.PlayerAction action) { List <Quest> validActionQuests = quests.FindAll(q => q.trigger.action == action); validActionQuests.Sort((q1, q2) => q2.trigger.probability.CompareTo(q1.trigger.probability)); foreach (Quest quest in validActionQuests) { float random = Random.value * 100f; if (quest.trigger.probability < random) { continue; } questQueue.Enqueue(new Tuple <Quest, Player>(quest, player)); break; } }
//Listener private void PlayerAction(Player.PlayerAction playerAction) { switch (playerAction) { case Player.PlayerAction.reflect: soundPlayer.RandomizeSfx(reflectSound); break; case Player.PlayerAction.charge: //soundPlayer.PlaySingle(chargeSound); break; case Player.PlayerAction.decharge: break; default: break; } }
public void SetAction(Player.PlayerAction action) { this.action = action; }
IEnumerator Dialoging(Player.PlayerAction action) { yield return(new WaitForSeconds(dialogueDelay)); action.Invoke(); }
public void EndDialogue(Player.PlayerAction action) { OnEndTalk.Invoke(); StartCoroutine(Dialoging(action)); dialogueDelay = 0; }