/// <summary> /// 施放技能条件 /// </summary> public virtual void UserSkill() { if (isSkill == false) { cd += Time.deltaTime; if (cd >= CDTime) { cd = CDTime; } sprite_Mask.fillAmount = 1 - cd / CDTime; if (sprite_Mask.fillAmount <= 0) { isSkill = true; } } if (sprite_Mask.fillAmount == 0 && isSkill && globe.Start_Count >= 3 && Input.GetKeyDown(skillKeyBoard)) { GameObject skill = Instantiate(Resources.Load("LARA") as GameObject, player.position, Quaternion.identity); sprite_Mask.fillAmount = 1; cd = 0f;//冷却时间重置 globe.Start_Count -= 3; globe.UpdateShow(); isSkill = false;//禁止施放技能,进入冷却时间 } }
private void OnTriggerEnter2D(Collider2D collision) { if (collision.gameObject.tag == "Player") { GlobeManager globe = GlobeManager._Instance; globe.Player_Hp -= 0.5f; EnemyCount._Instance.EnCount -= 1; globe.UpdateShow(); Destroy(gameObject, 0.1f); } if (collision.gameObject.tag == "bullet") { hp -= 0.5f; print("Bear 掉血 " + hp); Destroy(collision.gameObject); if (hp <= 0) { EnemyCount._Instance.EnCount -= 1; Destroy(gameObject, 0.1f); } } if (collision.gameObject.tag == "FirstSkill") { hp -= 1.5f; print("Bear 掉血 " + hp); Destroy(collision.gameObject); if (hp <= 0) { EnemyCount._Instance.EnCount -= 1; Destroy(gameObject, 0.1f); } } }
/// <summary> /// 施放技能条件 /// </summary> public virtual void UserSkill() { if (isSkill == false) { cd += Time.deltaTime; if (cd >= CDTime) { cd = CDTime; } sprite_Mask.fillAmount = 1 - cd / CDTime; if (sprite_Mask.fillAmount <= 0) { // player.gameObject.GetComponent<BoxCollider2D>().enabled = true; isSkill = true; } } if (sprite_Mask.fillAmount == 0 && isSkill && globe.Start_Count >= 3 && Input.GetKeyDown(skillKeyBoard)) { GameObject skill = Instantiate(Resources.Load("Shield") as GameObject, player.position, Quaternion.identity, player); skill.transform.localPosition = new Vector3(1.4f, 0, 0); sprite_Mask.fillAmount = 1; cd = 0; globe.Start_Count -= 3; globe.UpdateShow(); // player.gameObject.GetComponent<BoxCollider2D>().enabled = false; isSkill = false;//禁止施放技能,进入冷却时间 } }
private void OnTriggerEnter2D(Collider2D collision) { if (collision.gameObject.tag == "Player") { GlobeManager globe = GlobeManager._Instance; globe.Player_Hp -= 1 / 8.0f; globe.UpdateShow(); Destroy(gameObject); } }
private void OnTriggerEnter2D(Collider2D collision) { if (collision.gameObject.tag == "Player") { GlobeManager globe = GlobeManager._Instance; globe.Player_Hp -= 0.5f; globe.UpdateShow();//调用事件,更新 血量 Destroy(gameObject, 0.1f); } }
private void OnTriggerEnter2D(Collider2D collision) { if (collision.gameObject.tag == "Player") { GlobeManager globe = GlobeManager._Instance; globe.Blood_Count += 2; globe.UpdateShow(); VideoManager.Instance.PlayClip("larabottle"); Destroy(gameObject); } }
/// <summary> /// 主角加血 /// </summary> public void PlayerAddHp(bool isDown) { if (isDown) { GlobeManager globe = GlobeManager._Instance; if (globe.Blood_Count >= 2 && globe.Player_Hp < 1) { globe.Blood_Count -= 2; globe.Player_Hp += 0.25f; globe.UpdateShow(); } } }
/// <summary> /// 施放技能条件 /// </summary> public virtual void UserSkill() { if (isSkill == false) { cd += Time.deltaTime; if (cd >= CDTime) { cd = CDTime; } sprite_Mask.fillAmount = 1 - cd / CDTime; if (sprite_Mask.fillAmount <= 0) { isSkill = true; } } if (sprite_Mask.fillAmount == 0 && isSkill && globe.Start_Count >= 3 && Input.GetKeyDown(skillKeyBoard)) { if (player.localScale.x > 0) { player.position += new Vector3(disTran, 0, 0); MouseMove._Instance.currentPoint = player.position; } else { player.position -= new Vector3(disTran, 0, 0); MouseMove._Instance.currentPoint = player.position; } // MouseMove._Instance.currentPoint = transform.position; sprite_Mask.fillAmount = 1; cd = 0f;//冷却时间重置 globe.Start_Count -= 3; globe.UpdateShow(); isSkill = false;//禁止施放技能,进入冷却时间 } }
private void OnTriggerEnter2D(Collider2D collision) { if (collision.gameObject.tag == "Player") { GameObject boom = Instantiate(Resources.Load("boom") as GameObject, transform.position, Quaternion.identity, enemyParent); GlobeManager globe = GlobeManager._Instance; globe.Player_Hp -= 0.5f; EnemyCount._Instance.EnCount -= 1; globe.UpdateShow(); print("boom "); Destroy(gameObject, 0.1f); } if (collision.gameObject.tag == "bullet") { hp -= 0.4f; print("boom 掉血 " + hp); Destroy(collision.gameObject); if (hp <= 0) { EnemyCount._Instance.EnCount -= 1; Destroy(gameObject, 0.1f); } } if (collision.gameObject.tag == "FirstSkill") { hp -= 1.5f; print("boom 掉血 " + hp); Destroy(collision.gameObject); if (hp <= 0) { EnemyCount._Instance.EnCount -= 1; Destroy(gameObject, 0.1f); } } }