// HP 통지 정보 수신 함수. public void OnReceiveHitPointPacket(int node, PacketId id, byte[] data) { HitPointPacket packet = new HitPointPacket(data); HpData hpData = packet.GetPacket(); //Debug.Log("[CLIENT] Receive hitpoint packet:" + hpData.characterId); chrBehaviorBase behavior = findCharacter <chrBehaviorBase>(hpData.characterId); if (behavior == null) { return; } chrController controller = behavior.control; if (controller == null) { return; } if (controller.global_index < 0) { return; } //string log = "[CLIENT] Set HP:" + hpData.characterId + " HP:" + hpData.hp; //Debug.Log(log); // 캐릭터의 HP 반영. controller.setHitPoint(hpData.hp); }
// 소환 해제. private void unsummonBeast() { if (this.beast == null) { return; } this.summon_time += Time.deltaTime; string beast_name = this.beast.GetComponent <chrController>().name; GameObject go = GameObject.Find(beast_name); if (go != null) { GameObject.Destroy(go); } this.beast = null; this.summon_time = 0.0f; //Debug.Log("[CLIENT] Unsummon beast:" + beast_name); this.state = SUMMON_STATE.INTERVAL; }
// 근접 공격이 통했을 때 호출된다. public override void onMeleeAttackHitted(chrBehaviorBase other) { // 근접 공격으로 적을 10마리 쓰러뜨릴 때마다 캔디가 나온다. do { if (other.control.vital.getHitPoint() > 0) { break; } this.melee_count++; if (this.melee_count % 10 != 0) { break; } chrBehaviorEnemy enemy = other as chrBehaviorEnemy; if (enemy == null) { break; } enemy.setRewardItem("candy00", "candy00", null); } while(false); }
// 소환수를 소환 public void summonBeast(string beast_name) { do { if (this.beast != null) { break; } if (beast_name == "") { break; } string avator_name = "Beast_" + beast_name; string behavior_name = "chrBehaviorBeast_" + beast_name; chrController chr = CharacterRoot.getInstance().summonBeast(avator_name, behavior_name); if (chr == null) { break; } this.beast = chr.behavior; this.beast.control.cmdSetPositionAnon(this.getLocalPlayer().control.getPosition() + Vector3.back * 4.0f); this.summon_time = 0.0f; this.state = SUMMON_STATE.APPEAR; //Debug.Log("[CLIENT] Summon beast:" + beast_name); } while(false); }
public void setTarget(chrBehaviorEnemy target) { this.target = target; }
// 근접공격이 히트했을 때 호출됩니다. public virtual void onMeleeAttackHitted(chrBehaviorBase other) { }
// 소환 해제. private void unsummonBeast() { if (this.beast == null) { return; } this.summon_time += Time.deltaTime; string beast_name = this.beast.GetComponent<chrController>().name; GameObject go = GameObject.Find(beast_name); if (go != null) { GameObject.Destroy(go); } this.beast = null; this.summon_time = 0.0f; //Debug.Log("[CLIENT] Unsummon beast:" + beast_name); this.state = SUMMON_STATE.INTERVAL; }
// 소환수를 소환 public void summonBeast(string beast_name) { do { if(this.beast != null) { break; } if(beast_name == "") { break; } string avator_name = "Beast_" + beast_name; string behavior_name = "chrBehaviorBeast_" + beast_name; chrController chr = CharacterRoot.getInstance().summonBeast(avator_name, behavior_name); if(chr == null) { break; } this.beast = chr.behavior; this.beast.control.cmdSetPositionAnon(this.getLocalPlayer().control.getPosition() + Vector3.back*4.0f); this.summon_time = 0.0f; this.state = SUMMON_STATE.APPEAR; //Debug.Log("[CLIENT] Summon beast:" + beast_name); } while(false); }
// 근접 공격이 통했을 때 호출된다. public override void onMeleeAttackHitted(chrBehaviorBase other) { // 근접 공격으로 적을 10마리 쓰러뜨릴 때마다 캔디가 나온다. do { if(other.control.vital.getHitPoint() > 0) { break; } this.melee_count++; if(this.melee_count%10 != 0) { break; } chrBehaviorEnemy enemy = other as chrBehaviorEnemy; if(enemy == null) { break; } enemy.setRewardItem("candy00", "candy00", null); } while(false); }
public void setTarget(chrBehaviorEnemy target) { this.target = target; }