本文整理汇总了C#中states类的典型用法代码示例。如果您正苦于以下问题:C# states类的具体用法?C# states怎么用?C# states使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
states类属于命名空间,在下文中一共展示了states类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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();
}
开发者ID:pontura,项目名称:PungaRaid,代码行数:7,代码来源:Rati.cs
示例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;
}
}
}
开发者ID:dany1532,项目名称:Unity485_Follow_Your_Heart,代码行数:33,代码来源:EnemiesAI.cs
示例3: isState
public bool isState(states st)
{
if (state == st)
return true;
else
return false;
}
开发者ID:abelsiqueira,项目名称:unity-cube-testing,代码行数:7,代码来源:State.cs
示例4: ChumboFire
public void ChumboFire()
{
state = states.CHUMBO_FIRE;
animator.Play("pungaFireMegachumbo", 0, 0);
Invoke("EndAnimation", 0.5f);
Events.OnSoundFX("megachumbo");
}
开发者ID:pontura,项目名称:PungaRaid,代码行数:7,代码来源:Hero.cs
示例5: StateObject
public StateObject(DataHistoryRow passeddata)
{
_callLevel = 0;
_isOperation = false;
_data = passeddata;
_currentState = states.OT;
}
开发者ID:YourTradingSystems,项目名称:4XGain,代码行数:7,代码来源:StateObject.cs
示例6: Start
// Use this for initialization
void Start()
{
state = states.IDLE;
print (states.NUM_STATES + " : "+ MAX_STATES);
Player = GameObject.FindGameObjectWithTag("Player").transform;
}
开发者ID:snotwadd20,项目名称:UnityLevelGen,代码行数:8,代码来源:nearEnemy.cs
示例7: Strike
public void Strike(Vector2 pos, float waittime, float yValue)
{
mStrikePos = pos;
mState = states.MOVING;
mStrikeTime = waittime;
mYValue = yValue;
}
开发者ID:fattjake,项目名称:tctk,代码行数:7,代码来源:Weapon.cs
示例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);
}
开发者ID:Kostas333,项目名称:PiratesDemo,代码行数:35,代码来源:movigObjectScript.cs
示例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;
}
开发者ID:grodranlorth,项目名称:tctk,代码行数:28,代码来源:Character.cs
示例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;
}
}
开发者ID:kevdotbadger,项目名称:pingdong,代码行数:31,代码来源:StateManager.cs
示例11: Start
// Use this for initialization
void Start () {
moveDirection = states.STOP;
player = GameObject.FindGameObjectWithTag("Player");
playerState = player.gameObject.GetComponent<Move> ();
}
开发者ID:Kostas333,项目名称:PiratesDemo,代码行数:8,代码来源:movigObjectScript.cs
示例12: PlayerInsideNest
public void PlayerInsideNest()
{
if (state != states.Angry) {
state = states.Chasing;
alert = true;
}
}
开发者ID:aikelb,项目名称:ludum33,代码行数:7,代码来源:Chicken.cs
示例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;
}
}
开发者ID:pkerkidhd,项目名称:Game610Final,代码行数:25,代码来源:PlayerMovement.cs
示例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);
}
开发者ID:pontura,项目名称:PungaRaid,代码行数:8,代码来源:RatiJump.cs
示例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");
}
开发者ID:billyboy429,项目名称:tctk,代码行数:8,代码来源:Item.cs
示例16: OnTriggerEnter2D
void OnTriggerEnter2D(Collider2D other)
{
if (other.gameObject.tag == "Player" && playerCtrl.currentState != playerControl.states.hiding && currentState != states.movingToBad && currentState != states.sleeping) {
findWay(pointsOfInterests[0]);
currentState = states.movingToBad;
scaryLevel = 0;
}
}
开发者ID:Gennyi,项目名称:Bad-monsters,代码行数:8,代码来源:childControl.cs
示例17: OnExplote
public override void OnExplote()
{
if (state == states.CRASHED) return;
state = states.CRASHED;
Events.OnAddExplotion(laneId, (int)transform.localPosition.x);
Pool();
}
开发者ID:pontura,项目名称:PungaRaid,代码行数:9,代码来源:Runner.cs
示例18: Attack
void Attack(int selected)
{
print ("ATTACKING");
Item attackweapon = Weapon.GetComponent<Item>();
attackweapon.Lethal = true;
attackweapon.Range.enabled = true;
attacking = attackweapon.AttackSpeed;
State = states.Attacking;
}
开发者ID:zjucsxxd,项目名称:goodsireartthoumyslayer,代码行数:9,代码来源:Player.cs
示例19: OnHeroDash
public void OnHeroDash()
{
if (Game.Instance.state != Game.states.PLAYING) return;
if (state == states.DASH) return;
if (state == states.CRASH) return;
state = states.DASH;
animator.SetBool(state.ToString(), true);
animator.Play("pungaDash", 0, 0);
}
开发者ID:pontura,项目名称:PungaRaid,代码行数:9,代码来源:Hero.cs
示例20: Weapon
public Weapon(ContentManager cm, GraphicsDeviceManager graphics)
{
mCharManager = CharacterManager.GetInstance(cm, graphics);
mTexture = null;
mScale = new Vector2(1.0f, 0.0f);
mStrikeTime = 0;
mStrikePos = Vector2.Zero;
mState = states.NORMAL;
mOnScreenTime = 0.5f;
}
开发者ID:billyboy429,项目名称:tctk,代码行数:10,代码来源:Weapon.cs
注:本文中的states类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论