void Use_Skill() { switch (currentState) { case SMBState.READY: // perform skill Use_Bomb(); GetComponent <NetworkTransform>().transformSyncMode = NetworkTransform.TransformSyncMode.SyncTransform; // reset cd timer currentState = SMBState.BIG; this.cdTimer = this.cdTime; Debug.Log("BOMBING!"); break; case SMBState.BIG: break; case SMBState.COOLDOWN: Debug.Log("Skill still on cooldown!"); break; default: break; } }
private Vector3 _playerSpawnPointpos; // player to spawn here // Use this for initialization void Start() { // prevents rolling GetComponent <Rigidbody>().constraints = RigidbodyConstraints.FreezeRotationX | RigidbodyConstraints.FreezeRotationZ; // initialise rigidbody this.rb = GetComponent <Rigidbody>(); // gets current transform myTransform = transform; numberOfLives = 3; this.originalSize = transform.localScale; this.currentState = SMBState.READY; this.myScale = transform.localScale; this.lastTouch = this.gameObject; this._playerSpawnPointpos = transform.position; GameObject.FindWithTag("GameOver").GetComponent <Text>().text = ""; GameObject.FindWithTag("Lives").GetComponent <Text>().text = string.Format("Lives: {0}", numberOfLives); }
// decrements skill cd timer void Skill_CD_Timer() { if (cdTimer > 0) { cdTimer -= Time.deltaTime; //Debug.Log(cdTimer); } else { currentState = SMBState.READY; //Debug.Log("Skill ready!"); } if (currentState != SMBState.READY) { GameObject.Find("SkillButton").GetComponentInChildren <Text>().text = cdTimer.ToString(); } else { GameObject.Find("SkillButton").GetComponentInChildren <Text>().text = "Skill"; } }