本文整理汇总了C#中states类的典型用法代码示例。如果您正苦于以下问题:C# states类的具体用法?C# states怎么用?C# states使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
states类属于命名空间,在下文中一共展示了states类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Enemy_Init
public override void Enemy_Init(EnemySettings settings, int laneId)
{
anim.Play("copShieldIdle");
state = states.IDLE;
GetComponent<BoxCollider2D>().enabled = true;
heads.sprite = Data.Instance.enemiesManager.GetRandomHead();
}
示例2: Update
// Update is called once per frame
void Update()
{
if(state == states.chase)
{
if (transform.position.x < Globals.heroPos.x)
{
transform.Translate (Vector3.right * Time.deltaTime * moveSpeed );
}
else if (transform.position.x > Globals.heroPos.x)
{
transform.Translate (Vector3.left * Time.deltaTime * moveSpeed );
}
}
else if(state == states.patrolLeft)
{
transform.Translate (Vector3.left * Time.deltaTime * moveSpeed );
if(transform.position.x < minPosX)
{
state = states.patrolRight;
}
}
else if(state == states.patrolRight)
{
transform.Translate (Vector3.right * Time.deltaTime * moveSpeed );
if(transform.position.x > maxPosX)
{
state = states.patrolLeft;
}
}
}
示例3: isState
public bool isState(states st)
{
if (state == st)
return true;
else
return false;
}
示例4: ChumboFire
public void ChumboFire()
{
state = states.CHUMBO_FIRE;
animator.Play("pungaFireMegachumbo", 0, 0);
Invoke("EndAnimation", 0.5f);
Events.OnSoundFX("megachumbo");
}
示例5: StateObject
public StateObject(DataHistoryRow passeddata)
{
_callLevel = 0;
_isOperation = false;
_data = passeddata;
_currentState = states.OT;
}
示例6: Start
// Use this for initialization
void Start()
{
state = states.IDLE;
print (states.NUM_STATES + " : "+ MAX_STATES);
Player = GameObject.FindGameObjectWithTag("Player").transform;
}
示例7: Strike
public void Strike(Vector2 pos, float waittime, float yValue)
{
mStrikePos = pos;
mState = states.MOVING;
mStrikeTime = waittime;
mYValue = yValue;
}
示例8: Update
void Update () {
if (playerState.facing == Move.faceStates.FACERIGHT && isHit && rightMoveable)
{
Yspeed = 0;
Xspeed = speed;
isHit = false;
moveDirection = states.RIGHT;
}
if (playerState.facing == Move.faceStates.FACEUP && isHit && upMoveable)
{
Yspeed = speed;
Xspeed = 0;
isHit = false;
moveDirection = states.UP;
}
if (playerState.facing == Move.faceStates.FACELEFT && isHit && leftMoveable)
{
Yspeed = 0;
Xspeed = -speed;
isHit = false;
moveDirection = states.LEFT;
}
if (playerState.facing == Move.faceStates.FACEDOWN && isHit && downMoveable)
{
Yspeed = -speed;
Xspeed = 0;
isHit = false;
moveDirection = states.DOWN;
}
isHit = false;
transform.position = new Vector2 (transform.position.x +Xspeed*Time.deltaTime, transform.position.y +Yspeed*Time.deltaTime);
}
示例9: Character
public Character(string textureName, Vector2 position, ContentManager content, int frameCount)
{
mContent = content;
mTextureName = textureName;
mPosition = position;
mAge = age.BABY;
mStates = states.SPAWNING;
mSpeed = new Vector2(1.0f, 0.25f);
//mSpeed = new Vector2(0, 0);
mSprite = new AnimatedSprite();
//mSprite.Load(mContent, "AnimatedSprites/" + mTextureName, frameCount, 30, 149, 139, false);
mSprite.Load(mContent, "AnimatedSprites/" + mTextureName, frameCount, 0.125f, 128, 128, false);
bSphere = new BoundingSphere(new Vector3(position.X + mSprite.getWidth() / 2, position.Y + mSprite.getHeight() / 2, 0), mSprite.getWidth() / 2);
distance = 10000;
destination = Vector2.Zero;
timeEating = 2.0f;
timeOnFire = 0.5f;
respawnRate = 3.0f;
remove = false;
multipleOfTwo = false;
hacktex = Class1.CreateCircle((int)mSprite.getWidth() / 2, Color.Yellow);
timespawning = 2.0f;
}
示例10: Idling
private void Idling()
{
if( Input.GetButton("DOWN") ){
state = states.CROUCHING;
}
if(
Input.GetButton("UP") && !Input.GetButton("RIGHT") ||
Input.GetButton("UP") && !Input.GetButton("LEFT")
){
state = states.JUMPING_UP;
}
if( Input.GetButton("UP") ){
state = states.JUMPING_UP;
}
if( Input.GetButton("RIGHT") ){
state = states.MOVING_RIGHT;
}
if( Input.GetButton("LEFT") ){
state = states.MOVING_LEFT;
}
if(
Input.GetButton("HK") ||
Input.GetButton("LK") ||
Input.GetButton("HP") ||
Input.GetButton("LP")
){
smm.isStandardAttacking = true; // Do move?
state = states.ATTACKING;
}
}
示例11: Start
// Use this for initialization
void Start () {
moveDirection = states.STOP;
player = GameObject.FindGameObjectWithTag("Player");
playerState = player.gameObject.GetComponent<Move> ();
}
示例12: PlayerInsideNest
public void PlayerInsideNest()
{
if (state != states.Angry) {
state = states.Chasing;
alert = true;
}
}
示例13: checkInput
void checkInput()
{
if (Input.GetMouseButton(0))
{
RaycastHit hit;
Ray ray = (Camera.main.ScreenPointToRay(Input.mousePosition));
if (Physics.Raycast(ray, out hit))
{
// Debug.Log("Hit: " + hit.transform.name);
if (hit.transform.name == "Ground")
{
movePoint = new Vector3(hit.point.x, 0, hit.point.z);
transform.LookAt(movePoint);
Debug.DrawLine(Camera.main.transform.position, hit.point);
currentState = states.Moving;
}
}
}
if (Input.GetMouseButton(1)) {
currentState = states.Attacking;
} else if (Input.GetMouseButtonUp(1)) {
currentState = states.Idle;
}
}
示例14: OnExplote
public override void OnExplote()
{
if (state == states.CRASHED) return;
state = states.CRASHED;
anim.Play("crashed");
GetComponent<BoxCollider2D>().enabled = false;
Events.OnAddExplotion(laneId, (int)transform.localPosition.x);
}
示例15: Item
public Item(string name, Vector2 position, ContentManager content)
{
mContent = content;
mTextureName = name;
mPosition = position;
mState = states.DRAW;
cupcake = mContent.Load<Texture2D>("Items/cupcake");
}