示例#1
0
 private void RemoveEvent()
 {
     SceneEvent.GetInstance().removeEventListener(SCENE_EVENT.ADD_PLAYER, OnAddPlayer);
     SceneEvent.GetInstance().removeEventListener(SCENE_EVENT.ADD_COMMAND, OnAddCommand);
     SceneEvent.GetInstance().removeEventListener(SCENE_EVENT.UPDATE_GRASS_ID, OnUpdateGrassId);
     SceneEvent.GetInstance().removeEventListener(SCENE_EVENT.UPDATE_CAMERA, OnUpdateCamera);
 }
示例#2
0
 //使用技能
 public void SkillCommand(SkillCommand command)
 {
     if (CanUseSkill() && null != command)
     {
         //BattleState = BATTLE_STATE.SKILL;
         SceneEvent.GetInstance().dispatchEvent(SCENE_EVENT.ADD_SKILL_PARSER, new Notification(command));
     }
 }
示例#3
0
    //收到玩家进入场景
    public void ParseEnterBattle(BPEnter bp)
    {
        SceneEvent.GetInstance().dispatchEvent(SCENE_EVENT.ADD_PLAYER, new Notification(bp));

        //通知其他玩家自己位置
        if (bp.BattleId != PlayerModule.GetInstance().RoleID&& !_sendList.Contains(bp.BattleId))
        {
            _sendList.Add(bp.BattleId);
            BattleProtocol.GetInstance().SendEnterBattle(PlayerModule.GetInstance().RoleID, PlayerModule.GetInstance().RoleJob);
        }
    }
示例#4
0
    /// <summary>
    /// 相机跟随玩家
    /// </summary>
    void FollowPlayer()
    {
        float upRidus   = Mathf.Deg2Rad * initialAngle;
        float flatRidus = Mathf.Deg2Rad * horizontalAngle;

        float x = tx; //initialDistance * Mathf.Cos(upRidus) * Mathf.Cos(flatRidus);
        float z = ty; //initialDistance * Mathf.Cos(upRidus) * Mathf.Sin(flatRidus);
        float y = tz; //initialDistance * Mathf.Sin(upRidus);

        transform.position = Vector3.zero;
        tempVector.Set(x, y, z);
        tempVector         = tempVector + target.position;
        transform.position = tempVector;
        tempVector.Set(target.position.x, target.position.y, target.position.z);

        transform.LookAt(tempVector);

        SceneEvent.GetInstance().dispatchEvent(SCENE_EVENT.UPDATE_CAMERA);
    }
示例#5
0
    private void CreatePlayerView(PlayerBattleInfo playerInfo)
    {
        if (null == playerInfo)
        {
            return;
        }

        GameObject gameObject = GameObject.Instantiate(_playerPrefab[playerInfo.CareerType]);

        gameObject.transform.localPosition = playerInfo.MovePos;
        gameObject.transform.parent        = _playerLayer;
        _charaViewDic.Add(playerInfo.BattleId, gameObject);
        gameObject.AddComponent <PlayerBattleActor>();
        gameObject.GetComponent <PlayerBattleActor>().SetInfo(playerInfo);
        //通知ui管理器 添加头像
        SceneEvent.GetInstance().dispatchEvent(SCENE_EVENT.ADD_UI_HEAD, new Notification(playerInfo));

        if (playerInfo.BattleId == PlayerModule.GetInstance().RoleID)
        {
            GameObject.Find("Main Camera").GetComponent <CameraFollow>().target = gameObject.transform;
            GameObject.Find("SkillJoystick").GetComponent <SkillArea>().player  = gameObject;
        }
    }
示例#6
0
 //添加伤害 显示
 public void AddHurt(HurtInfo info)
 {
     Hp += info.Value;
     SceneEvent.GetInstance().dispatchEvent(SCENE_EVENT.ADD_UI_HURT_VALUE, new Notification(info));
 }
示例#7
0
    //技能使用
    public void ParseSkillCommand(BPSkill bp)
    {
        SkillCommand command = FightDefine.GetSkillCommand(bp.BattleId, bp.Frame, bp.SkillId, bp.SkillDir, bp.TargetPos, bp.TargetId);

        SceneEvent.GetInstance().dispatchEvent(SCENE_EVENT.ADD_COMMAND, new Notification(command));
    }
示例#8
0
    //移动
    public void ParseMoveComand(BPMove bp)
    {
        MoveCommand command = FightDefine.GetMoveCommand(bp.BattleId, bp.Frame, bp.Dir);

        SceneEvent.GetInstance().dispatchEvent(SCENE_EVENT.ADD_COMMAND, new Notification(command));
    }
示例#9
0
 private void RemoveEvent()
 {
     SceneEvent.GetInstance().removeEventListener(SCENE_EVENT.ADD_SKILL_PARSER, OnAddSkillParser);
 }
示例#10
0
 private void RemoveEvent()
 {
     SceneEvent.GetInstance().removeEventListener(SCENE_EVENT.ADD_UI_HURT_VALUE, OnAddUIHurtValue);
     SceneEvent.GetInstance().removeEventListener(SCENE_EVENT.ADD_UI_HEAD, OnAddUIHead);
 }