public void SetData(Paca newPaca) { paca = newPaca; wearingPaca = GetComponent <WearingPaca>(); wearingPaca.WearNewPaca(paca); GetComponent <Animator>().runtimeAnimatorController = paca.alpacaAnimator; }
void OnTriggerEnter2D(Collider2D other) { GameObject otherObj = other.gameObject; if (otherObj.CompareTag("Player")) { // 데미지 입었을 때 그 다음 데미지까지 1초 쿨타임 if (Time.time - Player.instance.lastDamaged > 1.0f) { Player.instance.lastDamaged = Time.time; dialog.selectDialogEvent(); WearingPaca playerWearingPaca = otherObj.GetComponent <WearingPaca>(); Player.instance.PlayCaughtClip(); Player.instance.GetComponent <DamageEffect>().Play(); if (playerWearingPaca.Score == 0 && false == Player.instance.dead) { // 너무 바로 Game over 신으로 가지 않도록 한다.... Player.instance.GetComponent <PlayerGameOver>().GameOver(); // gameover } else { playerWearingPaca.RemoveAllPaca(); } } } }
void OnTriggerEnter2D(Collider2D other) { GameObject otherObj = other.gameObject; if (otherObj.CompareTag("Player")) { WearingPaca playerWearingPaca = otherObj.GetComponent <WearingPaca> (); playerWearingPaca.DumpAll(); } }
void OnTriggerEnter2D(Collider2D other) { // Debug.Log ("collide"); GameObject otherObj = other.gameObject; if (otherObj.CompareTag("PacaNPC")) { // Debug.Log ("other is paca npc"); WearingPaca otherWearingPaca = otherObj.GetComponent <WearingPaca> (); Paca otherPaca = otherWearingPaca.LostWearPaca(); Player.instance.PlayStealPacaClip(); if (null != otherPaca) { wearingPaca.WearNewPaca(otherPaca); var otherPacaMove = otherObj.GetComponent <PacaMove>(); if (null != otherPacaMove) { otherPacaMove.StartFlee(); } } try{ if (NPZ && (false == stealStat.ContainsKey(otherPaca))) { Player.instance.StartNewPacaZoomIn(); stealStat[otherPaca] = 1; } else { stealStat[otherPaca]++; } } catch (System.Exception e) { ; } /* * */ } }
private void Awake() { wearingPaca = gameObject.GetComponent <WearingPaca> (); }