本文整理汇总了C#中PlayerState类的典型用法代码示例。如果您正苦于以下问题:C# PlayerState类的具体用法?C# PlayerState怎么用?C# PlayerState使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PlayerState类属于命名空间,在下文中一共展示了PlayerState类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Move
PlayerState Move(PlayerState previous, KeyCode newKey)
{
float deltaX = 0, deltaY = 0, deltaZ = 0;
float deltaRotationY = 0;
switch (newKey) {
case KeyCode.Q:
deltaX = -0.5f;
break;
case KeyCode.S:
deltaZ = -0.5f;
break;
case KeyCode.E:
deltaX = 0.5f;
break;
case KeyCode.W:
deltaZ = 0.5f;
break;
case KeyCode.A:
deltaRotationY = -1f;
break;
case KeyCode.D:
deltaRotationY = 1f;
break;
}
return new PlayerState {
posX = deltaX + previous.posX,
posY = deltaY + previous.posY,
posZ = deltaZ + previous.posZ,
rotX = previous.rotX,
rotY = deltaRotationY + previous.rotY,
rotZ = previous.rotZ
};
}
开发者ID:LivingValkyrie,项目名称:Lab-07,代码行数:35,代码来源:Lab02a_PlayerControl.cs
示例2: StepForward
private void StepForward()
{
// TODO: Parse dialogues/action tree using an XML File instead of a long case statement
// case set A
switch (pState) {
case PlayerState.NORMAL:
pState = PlayerState.INPUT;
if (!inputPanel.activeSelf) inputPanel.SetActive(true);
EventSystem.current.SetSelectedGameObject(inputField.gameObject, null);
break;
case PlayerState.NARRATIVE:
StepNarrative();
break;
case PlayerState.INPUT:
pState = PlayerState.NORMAL;
inputPanel.SetActive(false);
break;
case PlayerState.INTERACT:
break;
default:
break;
}
// case set A end
steps++;
}
开发者ID:niccojacinto,项目名称:Texscape_BreakIn,代码行数:26,代码来源:WorldController.cs
示例3: Awake
protected override void Awake()
{
base.Awake();
State = PlayerState.Normal;
_audioSource = GetComponent<AudioSource>();
}
开发者ID:PythagoRascal,项目名称:DogmaDerby,代码行数:7,代码来源:Player.cs
示例4: Update
// Update is called once per frame
void Update()
{
deathtimeout -= Time.deltaTime;
animationtime -= Time.deltaTime;
switch (state) {
case PlayerState.ALIVE:
//Things that you would call every frame while the character is alive
if (myHealth.currentHealth <= 0) {
state = PlayerState.DYING;
}
break;
case PlayerState.DYING:
//things you need to do to "kill" the character
StartCoroutine (TriggerAnimator ("death"));
animationtime = 4f;
//animation.Play("MOB1_M1_Stand_Relaxed_Death_B");
//THIS IS THE THING THAT HELPS YOU
//THE PLAYER IS NOW ONLY DYING FOR ONE FRAME AND The ANIMATION PLAY IS ONLY CALLED ONCE
state = PlayerState.DEAD;
break;
case PlayerState.DEAD:
//Anything you need to do to clean up the character such as removing them from the scene or respawning, etc.
if(deathtimeout <= 0 && animationtime <= 0){
transform.position = GameObject.FindGameObjectWithTag ("Respawn").transform.position;
myHealth.currentHealth = 100;
deathtimeout = 4.0f;
state = PlayerState.ALIVE;
}
break;
}
}
开发者ID:gold-games,项目名称:alpha3,代码行数:35,代码来源:respawn1.cs
示例5: CancelAction
//Cancel the currently displayed action
public void CancelAction()
{
selectedUnit = null;
m_tiles.ClearSelectedTiles();
m_hud.HideUnitInfo();
e_playerState = PlayerState.Default;
}
开发者ID:mjz4277,项目名称:Terraforma,代码行数:8,代码来源:PlayerController.cs
示例6: Start
void Start ()
{
// Assign spawners to spawners array
spawners[0] = topAirSpawner;
spawners[1] = midAirSpawner;
spawners[2] = botAirSpawner;
spawners[3] = groundSpawner;
// Initialize texts to their respective GO's
hudPlayerHealth = HudPlayerHealthObj.GetComponent<Text>();
hudPlayerGold = HudPlayerGoldObj.GetComponent<Text>();
hudPlayerXP = HudPlayerXPObj.GetComponent<Text>();
// Initialize wave-time to 0
timeSinceWave = 0;
// Initialize PlayerState struct
playerState = new PlayerState(startingPlayerHealth, xpMultiplier, startingPlayerGold, startingPlayerXP, firstToSecondLevelXP);
// Initially disable attribute panel
GameObject.Find("AttributePanel").SetActive(false);
// Load attribute panel toggle label text ref
attrPanelToggLabel = GameObject.Find("Label").GetComponent<Text>();
// Init ref to Canvas object
canvas = GameObject.Find("Canvas").GetComponent<Canvas>();
}
开发者ID:wchaney98,项目名称:Hero-Forever,代码行数:28,代码来源:GameManager.cs
示例7: Start
void Start ()
{
player = GameObject.Find("Player");
playerState = player.GetComponent<PlayerState>();
ani = GetComponent<Animation>();
ani.Play("Idle");
}
开发者ID:YangJinwoo,项目名称:FPS,代码行数:7,代码来源:Spider.cs
示例8: Awake
// Use this for initialization
void Awake()
{
state = 3;
playerHealth = GameObject.Find("Player").GetComponent<PlayerState>();
spikes = transform.Find("spiketrap_spikes");
a = GetComponent<AudioSource>();
}
开发者ID:Jarbuckle,项目名称:purgatory,代码行数:8,代码来源:SpikeTrigger.cs
示例9: FixedUpdate
void FixedUpdate()
{
if (Input.GetAxisRaw("Switch Form") != 0 && m_StateTimer == 0)
{
m_Human.IsActive = !m_Human.IsActive;
m_Spirit.IsActive = !m_Spirit.IsActive;
if (m_Human.IsActive)
{
m_PlayerState = PlayerState.HUMAN;
m_Camera.Following = m_Human.gameObject;
}
else
{
m_PlayerState = PlayerState.SPIRIT;
m_Camera.Following = m_Spirit.gameObject;
}
m_Human.GetComponent<SpriteRenderer>().enabled = !m_Human.GetComponent<SpriteRenderer>().enabled;
m_Spirit.GetComponent<SpriteRenderer>().enabled = !m_Spirit.GetComponent<SpriteRenderer>().enabled;
ChangeSceneMode();
m_StateTimer = 0.5f;
}
else if (m_StateTimer > 0)
{
m_StateTimer -= Time.deltaTime;
m_StateTimer = Mathf.Clamp(m_StateTimer, 0.0f, m_StateTimer);
}
}
开发者ID:AustinMorrell,项目名称:Body-and-Soul,代码行数:30,代码来源:Game_Controller.cs
示例10: GameOver
void GameOver()
{
ePS = PlayerState.DEATH;
SoundPlay(ESound.DEATH);
GM.GameOver();
}
开发者ID:CodeZob,项目名称:BoxRunner,代码行数:7,代码来源:Player_Ctrl.cs
示例11: SetState
private void SetState(PlayerState new_state)
{
if (this.currentState != null)
this.currentState.End ();
this.currentState = new_state;
this.currentState.Start ();
}
开发者ID:JulianG,项目名称:MossRunningGame,代码行数:7,代码来源:PlayerFSM.cs
示例12: SafeState
// public LevelState level;
//Stats
// public float timePlayed = 0.0F;
public SafeState()
{
// current = new SafeState();
// allLevels = new List<LevelState>();
// level = new LevelState();
player = new PlayerState();
}
开发者ID:elephantatwork,项目名称:Secret-Game,代码行数:10,代码来源:SafeState.cs
示例13: handleInput
void handleInput()
{
PlayerState state = playerState_.handleInput ();
if (state != null) {
playerState_ = state;
}
}
开发者ID:vpatel90,项目名称:Unity2DIso,代码行数:7,代码来源:PlayerController.cs
示例14: Start
// Use this for initialization
protected override void Start()
{
base.Start();
pController = GetComponent<PlayerControllerIso>();
pState = PlayerState.RUNNING;
canRoll = true;
}
开发者ID:shotgunfoot,项目名称:GAME-SCRIPTS,代码行数:8,代码来源:PlayerIso.cs
示例15: Update
public override void Update(GameTime gameTime)
{
if (!GameState.IsPaused)
{
if (GameState.IsEnd)
{
ShowLabels.ShowEndGame();
FirstSprite.HandleSpriteMovement(gameTime);
SecondSprite.HandleSpriteMovement(gameTime);
if (!GameState.IsEnd)
{
FirstSprite.Stop();
SecondSprite.Stop();
}
}
else
{
ShowLabels.ShowWinner();
ShowLabels.ShowRound();
firstState = FirstSprite.HandleSpriteMovement(gameTime);
secondState = SecondSprite.HandleSpriteMovement(gameTime);
if (firstState == PlayerState.Move || secondState == PlayerState.Move)
CollideDetector.RepairMoveCollision(FirstSprite, SecondSprite, width);
CollideDetector.HitCollision(FirstSprite, SecondSprite, gameTime);
FirstHealthBar.Update(FirstSprite.Information.Health);
SecondHealthBar.Update(SecondSprite.Information.Health);
WinnerDetector.DetectWinner(gameTime, FirstSprite, SecondSprite);
}
base.Update(gameTime);
}
}
开发者ID:HeaHDeRTaJIeC,项目名称:OOP-OSiSP-Projects,代码行数:32,代码来源:GameScreen.cs
示例16: Awake
// Use this for initialization
void Awake()
{
ItemInfoPanel = GameObject.FindGameObjectWithTag(Tags.UIRoot).transform.Find("EquepMenu").Find("ItemInfoPanel").GetComponent<UIItemInfoPanel>();
playerState = PlayerState._instance;
OnEquepChanged();
playerState.OnPlayerStateChanged += OnStateChanged;
}
开发者ID:tsss-t,项目名称:SimpleStory,代码行数:8,代码来源:UIEquepButtonEvent.cs
示例17: DoSpecializedAction
public override void DoSpecializedAction(PlayerState currentPlayer, GameState gameState)
{
currentPlayer.actionsToExecuteAtBeginningOfNextTurn.Add( delegate()
{
currentPlayer.AddCoins(1);
});
}
开发者ID:peterhal,项目名称:Dominulator,代码行数:7,代码来源:TestCards.cs
示例18: PlayerBehavior
public PlayerBehavior()
: base("PlayerBehavior")
{
this.direction = NONE;
this.trans2D = null;
this.currentState = PlayerState.Idle;
}
开发者ID:jaumefc,项目名称:arkanoid,代码行数:7,代码来源:PlayerBehavior.cs
示例19: KeyDownEvent
void KeyDownEvent()
{
if(Input.GetKeyDown(KeyCode.UpArrow)){
if(_state == PlayerState.standing) _state = PlayerState.running;
newIndex = 1;
if(newIndex != currentIndex) currentIndex = newIndex;
currentDir = Vector2.up;
}
if(Input.GetKeyDown(KeyCode.DownArrow)){
if(_state == PlayerState.standing) _state = PlayerState.running;
newIndex = 3;
if(newIndex != currentIndex) currentIndex = newIndex;
currentDir = -Vector2.up;
}
if(Input.GetKeyDown(KeyCode.LeftArrow)){
if(_state == PlayerState.standing) _state = PlayerState.running;
newIndex = 2;
if(newIndex != currentIndex) currentIndex = newIndex;
currentDir = -Vector2.right;
}
if(Input.GetKeyDown(KeyCode.RightArrow)){
if(_state == PlayerState.standing) _state = PlayerState.running;
newIndex = 0;
if(newIndex != currentIndex) currentIndex = newIndex;
currentDir = Vector2.right;
}
}
开发者ID:GITHZZ,项目名称:UnitySprite,代码行数:27,代码来源:Player.cs
示例20: Is
public static void Is(Player player, int x, int y, int score, PlayerState state)
{
Assert.Equal(x, player.Pos.X);
Assert.Equal(y, player.Pos.Y);
Assert.Equal(score, player.Score);
Assert.Equal(state, player.State);
}
开发者ID:gleroi,项目名称:k-rabbit,代码行数:7,代码来源:APlayer.cs
注:本文中的PlayerState类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论