// Start is called before the first frame update void Start() { GameObject player = GameObject.Find("Player"); php = player.GetComponent <PlayerHp>(); //cship.GetComponent<EnemyHp>(); }
private void OnTriggerEnter(Collider other) { GameObject Player = other.gameObject; PlayerHp component; if (PhotonScriptor.ConnectingScript.informPlayerID() == 1) { if ((component = Player.GetComponent <PlayerHp>()) != null && !Damaged) { PlayerHp.PlayerGetDamageforme(Givedamage); Damaged = true; } } GameObject Player2 = other.gameObject; PlayerHP2 component2; if (PhotonScriptor.ConnectingScript.informPlayerID() == 2) { if ((component2 = Player2.GetComponent <PlayerHP2>()) != null && !Damaged) { PlayerHP2.PlayerGetDamageforme(Givedamage); Damaged = true; } } }
// Start is called before the first frame update void Start() { GameObject player = GameObject.Find("Player"); php = player.GetComponent <PlayerHp>(); ehp = new EnemyHp(); }
private void OnTriggerEnter(Collider other) { if (other.CompareTag("hantei")) { return; } GameObject Player = other.gameObject; PlayerHp component; if ((component = Player.GetComponent <PlayerHp>()) != null) { if (PhotonScriptor.ConnectingScript.informPlayerID() != 1) { PlayerHp.PlayerGetDamage(Givedamage); } } GameObject Player2 = other.gameObject; PlayerHP2 component2; if ((component2 = Player2.GetComponent <PlayerHP2>()) != null) { if (PhotonScriptor.ConnectingScript.informPlayerID() != 2) { PlayerHP2.PlayerGetDamage(Givedamage); } } Destroy(this.gameObject); }
void OnTriggerEnter2D(Collider2D coll) { if (!coll.isTrigger && coll.gameObject.tag == "Player") { PlayerHp target = coll.GetComponent <PlayerHp>(); if (target != null) { target.SetDamage(15); } Destroy(gameObject); } if (!coll.isTrigger && coll.gameObject.tag == "Enemy") { BotHP target = coll.GetComponent <BotHP>(); if (target != null) { target.SetDamage(15); } Destroy(gameObject); } if (coll.gameObject.tag == "Ground") { Destroy(gameObject); } }
void Update() { if (PhotonScriptor.ConnectingScript.informPlayerID() == 1) { hp = PlayerHp.InformPlayerHP(); if (hp < 0) { hp = 0; } hpText.text = ""; int HpBar = (int)hp / 5; for (int n = 0; n < HpBar; n++) { hpText.text += "|"; } } if (PhotonScriptor.ConnectingScript.informPlayerID() == 2) { hp = PlayerHP2.InformPlayerHP(); if (hp < 0) { hp = 0; } hpText.text = ""; int HpBar = (int)hp / 5; for (int n = 0; n < HpBar; n++) { hpText.text += "|"; } } }
private void Start() { audioSource = GetComponent <AudioSource>(); childGameObject = transform.GetChild(0).gameObject; playerHp = GameObject.Find("Player").GetComponent <PlayerHp>(); score = GameObject.Find("Score").GetComponent <Score>(); }
private void OnTriggerEnter2D(Collider2D collision) { PlayerHp playerFromConllision = collision.GetComponent <PlayerHp>(); if (playerFromConllision != null) { playerFromConllision.TakeDamage(); } }
// 충돌 했을 때. void OnTriggerEnter(Collider _Col) { if (_Col.transform.CompareTag("Player")) { // 플레이어의 스크립트 컴포넌트를 가져온다. pInfo = _Col.GetComponent <PlayerHp>(); StartCoroutine("StartDamage"); } }
private void OnCollisionEnter2D(Collision2D collision) { PlayerHp playerFromConllision = collision.gameObject.GetComponent <PlayerHp>(); if (playerFromConllision != null) { playerFromConllision.TakeDamage(); } }
private void Awake() { character = FindObjectOfType <PlayerHp>(); for (int i = 0; i < hearts.Length; i++) { hearts[i] = transform.GetChild(i); } }
// Use this for initialization void Start() { currentPotion = maxPotion - 2; currentAmno = maxAmno; currentMeleeBonus = 0; currentHP = HPLevels [1]; currentAttack = attackLevels [1]; currentDefence = defenceLevels [1]; thePlayerHealth = FindObjectOfType <PlayerHp> (); }
private void OnTriggerEnter2D(Collider2D collision) { if (collision.gameObject.CompareTag("Player")) { PlayerHp player = collision.gameObject.GetComponent <PlayerHp>(); if (player != null) { player.Damage(DamageAmaount); Destroy(this.gameObject); } } }
// 충돌이 끝났을 때. void OnTriggerExit(Collider _Col) { if (_Col.transform.CompareTag("Player")) { // 코루틴을 멈춘다. StopCoroutine("StartDamage"); // 충돌이 끝난 후 정보를 플레이어의 정보를 게속 가지고 있을 필요가 // 없기 때문에 null로 초기화 해준다. pInfo = null; } }
private void OnTriggerEnter2D(Collider2D collision) { PlayerHp playerFromConllision = collision.GetComponent <PlayerHp>(); if (playerFromConllision != null) { playerFromConllision.TakeDamage(); } if ((collision.gameObject.tag != "Spawn") && (collision.gameObject.tag != "Enemy") && (collision.gameObject.tag != "Bullet")) { Destroy(gameObject); } }
private void RessetStats() { PlayerPrefs.SetInt("PlayerHp", 3); PlayerPrefs.SetInt("PlayerArmor", 0); PlayerPrefs.SetInt("PlayerStepCounter", 0); PlayerPrefs.SetInt("SpecialCounter", 0); PlayerHp = 3; PlayerArmor = 0; PlayerStepCounter = 0; MageCounter = 0; if (PlayerHpObject == null) { return; } SpecialCounter.GetComponentInChildren <TextMeshProUGUI>().text = MageCounter.ToString(); PlayerHpObject.GetComponentInChildren <TextMeshProUGUI>().text = PlayerHp.ToString(); PlayerArmorObject.GetComponentInChildren <TextMeshProUGUI>().text = PlayerArmor.ToString(); PlayerStepObject.GetComponentInChildren <TextMeshProUGUI>().text = PlayerStepCounter.ToString(); }
// Use this for initialization void Start() { theP1 = FindObjectOfType <PlayerHp> (); theP2 = FindObjectOfType <Player2Hp>(); }
// Start is called before the first frame update void Start() { audio = GetComponent <AudioSource>(); hp = GetComponent <PlayerHp>(); shield = GetComponent <PlayerShield>(); }
void Start () { player = GameObject.FindWithTag("Player"); playerHp = player.GetComponent<PlayerHp>(); }
// Start is called before the first frame update void Start() { image = GetComponent <Image>(); player = GameObject.FindGameObjectWithTag("Player"); playerHp = player.GetComponent <PlayerHp>(); }