public void SetFaceState(int stateNum) { switch (stateNum) { case 0: this.state = faceStates.CONFUSED; break; case 1: this.state = faceStates.CHEER; break; default: break; } cycleCounter = wait; }
void Update() { switch (state) { case faceStates.HAPPY: if (sr.sprite != happyFace) { sr.sprite = happyFace; } break; case faceStates.CONFUSED: if (sr.sprite != confusedFace) { sr.sprite = confusedFace; } if (cycleCounter > 0) { cycleCounter--; } else { state = faceStates.HAPPY; } break; case faceStates.CHEER: if (sr.sprite != cheerFace) { sr.sprite = cheerFace; } if (cycleCounter > 0) { cycleCounter--; } else { state = faceStates.HAPPY; } break; default: break; } }
void MoveDownAction() { if(facing == faceStates.FACEUP) { hitBox.transform.Rotate((Vector3.forward * 180),Space.World); } if(facing == faceStates.FACERIGHT) { hitBox.transform.Rotate((Vector3.forward * -90),Space.World); } if(facing == faceStates.FACELEFT) { hitBox.transform.Rotate((Vector3.forward * 90),Space.World); } facing =faceStates.FACEDOWN; }
void MoveUpAction() { if(facing == faceStates.FACEDOWN) { hitBox.transform.Rotate((Vector3.forward * 180),Space.World); frontWall(); //Instantiate(brick, hitBox.transform.position+(transform.forward*22), Quaternion.identity); } if(facing == faceStates.FACERIGHT) { hitBox.transform.Rotate((Vector3.forward * 90),Space.World); frontWall(); //Instantiate(brick, hitBox.transform.position+(transform.up*2), Quaternion.identity); } if(facing == faceStates.FACELEFT) { hitBox.transform.Rotate((Vector3.forward * -90),Space.World); frontWall(); //Instantiate(brick, hitBox.transform.position+(transform.forward*222), Quaternion.identity); } facing =faceStates.FACEUP; }
void MoveLeftAction() { if(facing == faceStates.FACEDOWN) { hitBox.transform.Rotate((Vector3.forward * -90),Space.World); } if(facing == faceStates.FACERIGHT) { hitBox.transform.Rotate((Vector3.forward * 180),Space.World); //Instantiate(brick_left, hitBox.transform.position+(transform.right*(-3)), brick_left.transform.rotation); } if(facing == faceStates.FACEUP) { hitBox.transform.Rotate((Vector3.forward * 90),Space.World); } facing =faceStates.FACELEFT; }
// Use this for initialization void Start() { state = faceStates.HAPPY; sr = this.GetComponent <SpriteRenderer>(); cycleCounter = 0; }