isPlayer() public method

public isPlayer ( ) : bool
return bool
Beispiel #1
0
    public void onEnterWorld(KBEngine.Entity entity)
    {
        if (entity.isPlayer())
        {
            return;
        }

        float y = entity.position.y;

        if (entity.isOnGround)
        {
            y = 1.3f;
        }

        switch (entity.className)
        {
        case "Avatar":
            entity.renderObj = Instantiate(proxyPrefab, new Vector3(entity.position.x, y, entity.position.z),
                                           Quaternion.Euler(new Vector3(entity.direction.y, entity.direction.z, entity.direction.x))) as UnityEngine.GameObject;
            break;

        case "Npc":
        case "Monster":
        case "Gate":
        default:
            entity.renderObj = Instantiate(entityPerfab, new Vector3(entity.position.x, y, entity.position.z),
                                           Quaternion.Euler(new Vector3(entity.direction.y, entity.direction.z, entity.direction.x))) as UnityEngine.GameObject;
            break;
        }
        ((UnityEngine.GameObject)entity.renderObj).name = entity.className + "_" + entity.id;
    }
Beispiel #2
0
    public void onEnterWorld(KBEngine.Entity entity)
    {
        Debug.Log("WorldEvent:entity." + entity.id + ",claseName:" + entity.className);

        if (entity.isPlayer())
        {
            if (GameData.Instance.RoomPlayers.Count <= 0)
            {
                GameData.Instance.RoomPlayers.Add((KBEngine.Avatar)entity);
            }
            else
            {
                GameData.Instance.RoomPlayers[0] = (KBEngine.Avatar)entity;
            }
            GameData.Instance.PlayerReady.Add(entity.id, false);
        }
        else if (entity.className == "Avatar")
        {
            if (GameData.Instance.RoomPlayers.Count <= 0)
            {
                GameData.Instance.RoomPlayers.Add(new KBEngine.Avatar());
            }
            GameData.Instance.RoomPlayers.Add((KBEngine.Avatar)entity);
            GameData.Instance.PlayerReady.Add(entity.id, false);
        }
    }
Beispiel #3
0
    private void InstanceUnLoadObj(KBEngine.Entity entity)
    {
        if (entity.className == "Avatar")
        {
            KBEngine.Avatar avatar = (KBEngine.Avatar)entity;

            GameObject obj = (GameObject)Resources.Load("Prefabs/AvatarPlayer");
            obj = Instantiate(obj, avatar.position, Quaternion.identity) as UnityEngine.GameObject;
            SpaceData.Instance.SpacePlayers.Add(((KBEngine.Avatar)entity).componentFrameSync);
            SpaceData.Instance.SpacePlayers = SpaceData.Instance.SpacePlayers.OrderBy(s => s.seatNo).ToList();


            if (avatar.teamID == CommonConfigs.RED_TEAM_ID)
            {
                //变换头发
            }
            obj.transform.forward = avatar.direction;

            if (entity.isPlayer())
            {
                AvatarPlayer      = obj;
                AvatarPlayer.name = PlayerCommonName.AvatarPlayerName;

                AddCameraFllow();
                AddController();
                // Debug.Log("entity_entity_entity:::" + entity.id + ",CurWeapon:::" + GameManager.Instance.CurWeapon);
            }
            FrameSyncManager.InitPlayerBehaviour(obj, avatar);
            entity.renderObj = obj;
            AddBattleRelateData(entity, obj);
            Debug.Log("name::" + avatar.name + " ,entity.id::" + entity.id + " ,position::" + avatar.position + ",direction::" + avatar.direction);
            return;
        }
    }
Beispiel #4
0
    public void set_state(KBEngine.Entity entity, sbyte v)
    {
        if (entity.renderObj != null)
        {
            if (((SByte)v) == 1)//死亡
            {
                ((UnityEngine.GameObject)(entity.renderObj)).GetComponent <Animator>().Play("Dead");
            }
            else
            {
                ((UnityEngine.GameObject)(entity.renderObj)).GetComponent <Animator>().Play("Idle");
            }
        }

        if (entity.isPlayer())
        {
            Debug.Log("player->set_state: " + v);

            UnityEngine.GameObject UIGame = UnityEngine.GameObject.FindGameObjectWithTag("UIGame");


            if (((SByte)v) == 1)
            {
                UIGame.GetComponent <UI_Game>().tran_relive.gameObject.SetActive(true);
            }
            else
            {
                UIGame.GetComponent <UI_Game>().tran_relive.gameObject.SetActive(false);
            }

            return;
        }
    }
Beispiel #5
0
    /// <summary>
    /// 1.获取当前玩家的playerID
    /// 2.创建一个SceneEntityObject 作为Entity的renderObj
    /// </summary>
    /// <param name="entity"></param>
    public void onEnterWorld(KBEngine.Entity entity)
    {
        Debug.Log("实体进入世界 KBEEventProc::onEnterWorld  entityID:" + entity.id);
        if (entity.renderObj != null)
        {
            Debug.LogWarning("实体已经有renderObj 无法再次进入");
            return;
        }

        SceneEntityObject obj = new SceneEntityObject();

        obj.kbentity     = entity;
        entity.renderObj = obj;


        if (entity.isPlayer())
        {
            currentPlayerID = Convert.ToInt16(entity.getDefinedProperty("playerID"));
        }
        else
        {
        }

        obj.onEnterWorld(entity.getDefinedProperty("playerID"));
    }
    public void set_direction(KBEngine.Entity entity)
    {
        if (enterSpace == false)
        {
            return;
        }

        if (entity.isPlayer() == false)
        {
            if (entity.renderObj != null)
            {
                ((SceneEntityObject)entity.renderObj).destDirection = new Vector3(entity.direction.y, entity.direction.z, entity.direction.x);
                //((SceneObject)entity.renderObj).rotation = new Vector3(entity.direction.y, entity.direction.z, entity.direction.x);
            }
            return;
        }

        RPG_Controller.initRot = new Vector3(entity.direction.y, entity.direction.z, entity.direction.x);
        //if(RPG_Controller.instance != null)
        if (!(System.Object.ReferenceEquals(RPG_Controller.instance, null)))
        {
            RPG_Controller.instance.transform.Rotate(RPG_Controller.rotation);
            Common.DEBUG_MSG("KBEEventProc::set_direction: RPG_Controller.rotation=" + RPG_Controller.instance.transform.rotation);
        }
    }
Beispiel #7
0
    public void set_state(KBEngine.Entity entity, object v)
    {
        if (enterSpace == false)
        {
            return;
        }

        if (entity.renderObj != null)
        {
            ((SceneEntityObject)entity.renderObj).set_state((SByte)v);
        }

        if (entity.isPlayer())
        {
            RPG_Controller.enabled = ((SByte)v) != 1;

            if (RPG_Controller.enabled == false)
            {
                game_ui_autopos.showRelivePanel();
            }
            else
            {
                game_ui_autopos.hideRelivePanel();
            }
        }
    }
Beispiel #8
0
    public void set_position(KBEngine.Entity entity)
    {
        if (entity.renderObj != null)
        {
            Common.calcPositionY(entity.position, out entity.position.y, false);
            ((SceneObject)entity.renderObj).position           = entity.position;
            ((SceneEntityObject)entity.renderObj).destPosition = entity.position;
        }

        if (entity.isPlayer() == false)
        {
            return;
        }

        entity.position = (Vector3)entity.getDefinedPropterty("position");

        RPG_Controller.initPos.x = entity.position.x;
        RPG_Controller.initPos.y = entity.position.y;
        RPG_Controller.initPos.z = entity.position.z;

        if (RPG_Controller.instance != null)
        {
            RPG_Controller.instance.transform.position = RPG_Controller.initPos;
            Common.DEBUG_MSG("KBEEventProc::set_position: entity.position=" + entity.position + " " + entity.getDefinedPropterty("position") + ", RPG_Controller.position=" + RPG_Controller.instance.transform.position);
        }
    }
Beispiel #9
0
    public void set_MP(KBEngine.Entity entity, object v)
    {
        object vv = entity.getDefinedPropterty("MP_Max");

        if (entity.renderObj != null)
        {
            object oldvv = entity.getDefinedPropterty("old_MP");
            if (oldvv != null)
            {
                Int32 diff = (Int32)vv - (Int32)oldvv;

                if (diff > 0)
                {
                    ((SceneEntityObject)entity.renderObj).addMP(diff);
                }

                entity.setDefinedPropterty("old_MP", vv);
            }
            else
            {
                entity.addDefinedPropterty("old_MP", vv);
            }
        }

        if (entity.isPlayer())
        {
            game_ui_autopos.updatePlayerBar_MP(v, vv);
        }
        else
        {
            game_ui_autopos.updateTargetBar_MP(v, vv);
        }
    }
Beispiel #10
0
 public override void onAttached(Entity ownerEntity)
 {
     if (ownerEntity.isPlayer())
     {
         SpaceData.Instance.localPlayer = this;
         KBEngine.Event.registerIn("reportFrame", this, "reportFrame");
     }
 }
Beispiel #11
0
 //更新玩家质量
 public void updatePlayerMass(KBEngine.Entity entity, object v)
 {
     if (entity.isPlayer())
     {
         gameMass.text = string.Format("体重:{0}千克", (int)v);
     }
     updatePlayerDict(((Account)entity).playerName, (int)v);
 }
    public void onEnterWorld(KBEngine.Entity entity)
    {
        if (entity.isPlayer())
        {
            return;
        }

        float y = entity.position.y;

        if (entity.isOnGound)
        {
            y = 1.3f;
        }

        entity.renderObj = Instantiate(entityPerfab, new Vector3(entity.position.x, y, entity.position.z),
                                       Quaternion.Euler(new Vector3(entity.direction.y, entity.direction.z, entity.direction.x))) as UnityEngine.GameObject;

        ((UnityEngine.GameObject)entity.renderObj).name = entity.className + "_" + entity.id;

        set_position(entity);
        set_direction(entity);

        object speed = entity.getDefinedPropterty("moveSpeed");

        if (speed != null)
        {
            set_moveSpeed(entity, speed);
        }

        object state = entity.getDefinedPropterty("state");

        if (state != null)
        {
            set_state(entity, state);
        }

        object modelScale = entity.getDefinedPropterty("modelScale");

        if (modelScale != null)
        {
            set_modelScale(entity, modelScale);
        }

        object name = entity.getDefinedPropterty("name");

        if (name != null)
        {
            set_entityName(entity, (string)name);
        }

        object hp = entity.getDefinedPropterty("HP");

        if (hp != null)
        {
            set_HP(entity, hp);
        }
    }
Beispiel #13
0
 public void recvDamage(KBEngine.Entity entity, KBEngine.Entity attacker, Int32 skillID, Int32 damageType, Int32 damage)
 {
     // Tmp:  Simulate skill casting
     if (!attacker.isPlayer())
     {
         GameEntity eCaster = ((UnityEngine.GameObject)attacker.renderObj).GetComponent <GameEntity>();
         GameEntity eTarget = ((UnityEngine.GameObject)entity.renderObj).GetComponent <GameEntity>();
         StartCoroutine(Combat.CastFireball(eCaster, eTarget, player.GetComponent <PlayerCtrl>()._coolTimeFireball));
     }
 }
Beispiel #14
0
    public void onEnterWorld(KBEngine.Entity entity)
    {
        if (gameObject == null || entity.isPlayer())
        {
            createPlayer();
            return;
        }

        GameObject perfab = null;

        Debug.Log("onEnterWorld." + entity.id + ",position:" + entity.position + ",direction:" + entity.direction);

        if (entity.className == "Avatar")
        {
            perfab = ChooseShip(entity);
        }
        else if (entity.className == "Weapon")
        {
            KBEngine.Weapon  arsenal     = (KBEngine.Weapon)entity;
            CONF.conf_bullet bullet_conf = (CONF.conf_bullet)CSVHelper.Instance.GetItem("conf_bullet", arsenal.uid);
            if (bullet_conf == null)
            {
                Debug.LogError("world::bullet_conf not found  arsenal.uid:" + arsenal.uid);
                return;
            }
            perfab = Resources.Load <GameObject>(bullet_conf.Perfab);
        }
        else if (entity.className == "Mine")
        {
            perfab = minePerfab;
        }
        else if (entity.className == "SupplyBox")
        {
            perfab = supplyBoxPerfab;
        }

        if (perfab == null)
        {
            Debug.LogError("entity." + entity.id + ",className:" + entity.className + ",SelectIndex:" + PlayerData.Instance.SelectIndex);
            return;
        }

        entity.renderObj = Instantiate(perfab, entity.position, Quaternion.Euler(entity.direction), transform) as UnityEngine.GameObject;
        ((GameObject)entity.renderObj).name = entity.className + "_" + entity.id;

        Debug.Log("onEnterWorld." + entity.id + ",rederObj:" + (UnityEngine.GameObject)entity.renderObj +
                  ",position:" + ((UnityEngine.GameObject)entity.renderObj).transform.position +
                  ",eulerAngles:" + ((UnityEngine.GameObject)entity.renderObj).transform.rotation.eulerAngles);

        if (entity.className == "Avatar")
        {
            ((GameObject)entity.renderObj).GetComponent <ShipBase>()._attri.Id = entity.id;
        }
//       ((UnityEngine.GameObject)entity.renderObj).transform.parent = transform;
    }
Beispiel #15
0
 public void set_MagicDef(KBEngine.Entity entity, object v)
 {
     if (!entity.isPlayer())
     {
         return;
     }
     if (onChangeMagicDef != null)
     {
         onChangeMagicDef(v);
     }
 }
Beispiel #16
0
 public void set_PhyAtack(KBEngine.Entity entity, object v)
 {
     if (!entity.isPlayer())
     {
         return;
     }
     if (onChangePhyAtack != null)
     {
         onChangePhyAtack(v);
     }
 }
Beispiel #17
0
 //装备
 public void EquiptedItem(KBEngine.Entity entity, object framIndex)
 {
     if (!entity.isPlayer())
     {
         return;
     }
     Debug.Log("EquiptedItem");
     if (onEquiptedItem != null)
     {
         onEquiptedItem(framIndex, null);
     }
 }
Beispiel #18
0
 public void DelBagItem(KBEngine.Entity entity, object serialnum)
 {
     if (!entity.isPlayer())
     {
         return;
     }
     Debug.Log("DelBagItem");
     if (onDelBagItem != null)
     {
         onDelBagItem(serialnum, null);
     }
 }
Beispiel #19
0
 public void AddBagItem(KBEngine.Entity entity, object framIndex, object itemIndex)
 {
     if (!entity.isPlayer())
     {
         return;
     }
     Debug.Log("AddBagItemaaaaaaaaaaaaaaa");
     if (onAddBagItem != null)
     {
         onAddBagItem(framIndex, itemIndex);
     }
 }
Beispiel #20
0
 //玩家dead
 public void onPlayerDead(KBEngine.Entity entity)
 {
     if (entity.renderObj == null)
     {
         return;
     }
     ((GameObject)entity.renderObj).SetActive(false);
     if (entity.isPlayer())
     {
         showWaitingTime();
     }
 }
Beispiel #21
0
 //玩家复活
 public void onPlayerAlive(KBEngine.Entity entity)
 {
     if (entity.renderObj == null)
     {
         return;
     }
     if (entity.isPlayer())
     {
         closeWaitingTime();
     }
     ((GameObject)entity.renderObj).SetActive(true);
 }
Beispiel #22
0
    //更新玩家速度
    public void updatePlayerSpeed(KBEngine.Entity entity, object v)
    {
        float s = (float)v;

        if (entity.isPlayer())
        {
            ETC.setPlayerSPeed(s, s);
        }
        else if (entity.renderObj != null)
        {
            ((GameObject)entity.renderObj).GetComponent <GameEntity>().speed = s;
        }
    }
Beispiel #23
0
    //更新玩家大小
    public void updatePlayerScale(KBEngine.Entity entity, object v)
    {
        float s = (float)v;

        if (entity.isPlayer())
        {
            mainCamera.orthographicSize = 4 + s;
        }
        if (entity.renderObj != null)
        {
            ((GameObject)entity.renderObj).transform.localScale = new Vector3(s, s, s);
        }
    }
Beispiel #24
0
    public void set_MP_Max(KBEngine.Entity entity, object v)
    {
        object vv = entity.getDefinedPropterty("MP");

        if (entity.isPlayer())
        {
            game_ui_autopos.updatePlayerBar_MP(vv, v);
        }
        else
        {
            game_ui_autopos.updateTargetBar_MP(vv, v);
        }
    }
Beispiel #25
0
 public override void onAttached(Entity ownerEntity)
 {
     if (ownerEntity.isPlayer())
     {
         KBEngine.Event.registerIn("reqSpaceList", this, "reqSpaceList");
         KBEngine.Event.registerIn("reqCreateSpace", this, "reqCreateSpace");
         KBEngine.Event.registerIn("reqRemoveSpace", this, "reqRemoveSpace");
         KBEngine.Event.registerIn("reqLoginSpace", this, "reqLoginSpace");
         KBEngine.Event.registerIn("reqLoginOutSpace", this, "reqLoginOutSpace");
         KBEngine.Event.registerIn("reqReady", this, "reqReady");
         KBEngine.Event.registerIn("reqGamePause", this, "reqGamePause");
         KBEngine.Event.registerIn("reqGameRunning", this, "reqGameRunning");
     }
 }
Beispiel #26
0
    public void onEnterWorld(KBEngine.Entity entity)
    {
        //entity为Account
        Debug.Log("onEnterWorld");
//		print("onEnterWorld");
//
//		entity.baseCall ("reqAvatarList");
//		print("onEnterWorld2");

        if (entity.isPlayer())
        {
            return;
        }
    }
Beispiel #27
0
    public void set_exp(KBEngine.Entity entity, object v)
    {
        //Debug.Log("set Exp ");
        if (!entity.isPlayer())
        {
            return;
        }
        // Debug.Log("set Exp " + v);
        object level = entity.getDefinedPropterty("level");

        Debug.LogWarning("level is " + (UInt16)level);
        object vv = Exp[(UInt16)level];

        //object vv = 2000;
        Debug.LogWarning("vv is " + (float)(Int32)vv);
        if (entity.isPlayer())
        {
            game_ui_autopos.updatePlayerBar_Exp(v, vv);
            if (onChangeexp != null)
            {
                onChangeexp(v);
            }
        }
    }
Beispiel #28
0
    public void set_level(KBEngine.Entity entity, object v)
    {
        if (game_ui_autopos.level_label == null)
        {
            return;
        }

        if (entity.isPlayer())
        {
            game_ui_autopos.level_label.text = "lv: " + v;
        }
        else
        {
            game_ui_autopos.target_level_label.text = "lv:" + v;
        }
    }
Beispiel #29
0
    public void set_HP_Max(KBEngine.Entity entity, object v)
    {
        object vv = entity.getDefinedPropterty("HP");

        if (entity.isPlayer())
        {
            game_ui_autopos.updatePlayerBar_HP(vv, v);
            if (onChangehpmax != null)
            {
                onChangehpmax(v);
            }
        }
        else
        {
            game_ui_autopos.updateTargetBar_HP(vv, v);
        }
    }
Beispiel #30
0
    public void onEnterWorld(KBEngine.Entity entity)
    {
        if (entity.isPlayer())
        {
            createPlayer();
        }
        else
        {
            UnityEngine.GameObject entityPerfab = null;

            float layer = 0.0f;

            if (entity.className == "Food")
            {
                entityPerfab = foodsPerfab;
                layer        = 100.0f;
            }
            else if (entity.className == "Smash")
            {
                layer = -9.0f;

                // 粉碎永远都应该在所有avatar和粮食的上面一层
                entityPerfab = smashsPerfab;
            }
            else
            {
                entityPerfab = avatarPerfab;
            }

            entity.renderObj = Instantiate(entityPerfab, new Vector3(entity.position.x, entity.position.z, layer),
                                           Quaternion.Euler(new Vector3(entity.direction.y, entity.direction.z, entity.direction.x))) as UnityEngine.GameObject;

            ((UnityEngine.GameObject)entity.renderObj).name = entity.className + "_" + entity.id;

            if (entity.className == "Avatar")
            {
                ((UnityEngine.GameObject)entity.renderObj).GetComponent <GameEntity>().isAvatar = true;
            }
            else if (entity.className == "Food")
            {
                ((UnityEngine.GameObject)entity.renderObj).GetComponent <GameEntity>().isFood = true;
            }
        }
    }