Пример #1
0
  public SCStageObjectDisappear.Builder createMsgDie() {
    SCStageObjectDisappear.Builder msgObjDisappear = SCStageObjectDisappear.newBuilder();
    msgObjDisappear.setObjId(id);
    msgObjDisappear.setType(2);

    return msgObjDisappear;
  }
Пример #2
0
  public void die(UnitObject killer, Param params) {
    Unit unit = getUnit();
    unit.setHpCur(0);

    // 设置状态
    inWorld = false;

    // 停止移动
    stop();

    Event.fireEx(
        EventKey.UNIT_BE_KILLED,
        stageObj.sn,
        "killer",
        killer,
        "dead",
        this,
        "skillSn",
        params.get("skillSn"));

    Param param = new Param(params);

    long killerId = 0;
    String killerName = "";
    int skillSn = Utils.getParamValue(param, "skillSn", 0);
    if (killer != null) {
      killerId = killer.id;
      killerName = killer.name;
    }

    // 通知其他玩家 有地图单元离开视野
    SCStageObjectDisappear.Builder msg = createMsgDie();
    msg.setKillerId(killerId);
    msg.setKillerName(killerName);
    msg.setSkillSn(skillSn);

    StageManager.inst().sendMsgToArea(msg, stageObj, posNow);
  }