示例#1
0
 void Awake()
 {
     Bind(FightEvent.FIGHT_DO_ATTACK, FightEvent.FIGHT_SET_FIREINTERVAL, FightEvent.FIGHT_RESET_FIREINTERVAL, FightEvent.FIGHT_SYNC_ARMSTYPS);
     FirePoint  = this.transform.Find("FirePoint");
     curBullet  = new BulletBase();
     damageMesg = new DamageMesg();
     effectMesg = new EffectMesg();
     shootDto   = new ShootDto();
 }
示例#2
0
    /// <summary>
    /// 本地玩家死亡
    /// </summary>
    private void LocalPlayerDeath(DamageMesg mesg)
    {
        Debug.Log("AWSL");
        DestroyPlayer(localAcc);
        DeathDto deathDto = new DeathDto(mesg.Account, localAcc, "戳死了");//TODO 枚举定义原因

        smg.Change(OpCode.GAME, GameCode.GAME_DEATH_CERQ, deathDto);
        Dispatch(AreaCode.NET, 0, smg);
        string msg = "<color=#ff4757>" + userDtoDict[deathDto.KillerAccount].Name + "</color>" + deathDto.Reason + "<color=##ffa502>" + userDtoDict[deathDto.VictimAccount].Name + "</color>\n";

        Dispatch(AreaCode.UI, UIEvent.UI_SET_GAME_INFO, msg);
        Dispatch(AreaCode.UI, UIEvent.UI_SHOWHIDE_ETC, false);
    }
示例#3
0
    /// <summary>
    /// 减少本地玩家的hp并发送给服务器
    /// </summary>
    private void ReduceHp(DamageMesg damageMesg)
    {
        int tempHp = localHp + damageMesg.Damage;

        tempHp = Mathf.Clamp(tempHp, 0, 100);
        SetLocalHp(tempHp);
        hpDto.Change(localAcc, localHp);
        smg.Change(OpCode.GAME, GameCode.GAME_SYNC_STATE_HP_CERQ, hpDto);
        Dispatch(AreaCode.NET, 0, smg);
        if (localHp == 0)
        {
            LocalPlayerDeath(damageMesg);
        }
    }