예제 #1
0
    void FixedUpdate()
    {
        KBEngine.Entity player = KBEngineApp.app.player();

        if (player != null)
        {
            player.position.x = transform.position.x;
            player.position.y = transform.position.y;
            player.position.z = transform.position.z;

            if (RPG_Animation.instance != null)
            {
                player.direction.z = RPG_Animation.instance.transform.rotation.eulerAngles.y;
            }

            if (characterController != null)
            {
                player.isOnGround = characterController.isGrounded;
            }
        }

        if (WorldManager.currinst != null)
        {
            WorldManager.currinst.Update();
        }
    }
예제 #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);
        }
    }
예제 #3
0
    public void onOtherAvatarEnterWorld(KBEngine.Entity entity)
    {
        Debug.Log("World::onOtherAvatarEnterWorld ... ClassName = " + entity.className + " EntityId =  " + entity.id);

        if (entity.className == "Avatar")
        {
            GameObject PlayerAvt = Instantiate(m_AvatarPrefab);
            if (PlayerAvt == null)
            {
                return;
            }
            entity.renderObj = PlayerAvt;
            PlayerAvt.GetComponent <AvatarView>().m_Avatar = entity as Avatar;
        }
        else if (entity.className == "Food")
        {
            GameObject FoodAvt = Instantiate(m_FoodPrefab);
            if (FoodAvt == null)
            {
                return;
            }
            entity.renderObj           = FoodAvt;
            FoodAvt.transform.position = new Vector3(entity.position.x, entity.position.z, entity.position.z);
        }
    }
예제 #4
0
    public void set_formation(KBEngine.Entity entity, object v)
    {
        v = entity.getDefinedProperty("formation");
        PlayerMediator.playerInfo.formation = int.Parse(v.ToString());

        Facade.SendNotification(NotificationID.Formation_Change);
    }
예제 #5
0
    public void dialog_setContent(Int32 talkerId, List <UInt32> dialogIds, List <string> dialogsTitles, string title, string body, string sayname)
    {
        KBEngine.Entity entity = KBEngineApp.app.player();
        KBEngine.Avatar avatar = null;
        if (entity != null && entity.className == "Avatar")
        {
            avatar = (KBEngine.Avatar)entity;
        }

        List <string>      titles  = new List <string>();
        List <UnityAction> actions = new List <UnityAction>();

        for (int i = 0; i < dialogsTitles.Count; i++)
        {
            titles.Add((string)dialogsTitles[i]);
            UInt32 dialogId = dialogIds[i];
            actions.Add(() => avatar.dialog(talkerId, dialogId));
        }
        if (titles.Count > 0)
        {
            MenuBox.Show
            (
                titles,
                actions,
                sayname + ": " + body
            );
        }
    }
예제 #6
0
 public void otherAvatarOnJump(KBEngine.Entity entity)
 {
     Debug.Log("otherAvatarOnJump: " + entity.id);
     if (entity.renderObj != null)
     {
         ((UnityEngine.GameObject)entity.renderObj).GetComponent <GameEntity>().OnJump();
     }
 }
예제 #7
0
 public void set_HP(KBEngine.Entity entity, Int32 v, Int32 HP_Max)
 {
     Dbg.DEBUG_MSG(entity.className + "::set_HP: " + v + " => " + HP_Max);
     if (entity.renderObj != null)
     {
         ((UnityEngine.GameObject)entity.renderObj).GetComponent <TankHealth>().SetHealth((float)v, (float)HP_Max);
     }
 }
예제 #8
0
    public void onSelfAvatarEnterWorld(KBEngine.Entity entity)
    {
        var avatar = Instantiate(m_AvatarMainPrefab);

        entity.renderObj = avatar;
        avatar.GetComponent <AvatarView>().m_AvatarMain = entity as Avatar;
        Debug.Log("World::onSelfAvatarEnterWorld ... id = " + entity.id);
    }
예제 #9
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);
 }
예제 #10
0
    public void Event_jumpToPosition(Vector3 pos, KBEngine.Entity entity)
    {
        GameObject gameObject = entity.renderObj as GameObject;

        //KBEngine.Avatar avatar = entity as KBEngine.Avatar;
        //avatar.position = pos;
        gameObject.transform.position = pos;
    }
예제 #11
0
 public void otherAvatarOnFire(KBEngine.Entity entity, Int32 value)
 {
     Debug.Log("World otherAvatarOnFire  entity.className = " + entity.className
               + " entity.id = " + entity.id);
     if (entity.renderObj != null)
     {
         ((UnityEngine.GameObject)entity.renderObj).GetComponent <EnityTankShooting>().onFire((float)value);
     }
 }
예제 #12
0
    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);
        }
    }
예제 #13
0
 public void set_blackMoney(KBEngine.Entity entity, object v)
 {
     v = entity.getDefinedProperty("blackMoney");
     PlayerMediator.playerInfo.blackMoney = int.Parse(v.ToString());
     if (GameShopMediator.gameShopMediator != null)
     {
         GameShopMediator.gameShopMediator.panel.moneyLabel.text = PlayerMediator.playerInfo.blackMoney.ToString();
     }
 }
예제 #14
0
    public void onControlled(KBEngine.Entity entity, bool isControlled)
    {
        if (entity.renderObj == null)
        {
            return;
        }

        Debug.Log("onControlled: " + entity.isControlled);
    }
예제 #15
0
 public void onEnterWorld(KBEngine.Entity entity)
 {
     if (enterSpace == false)
     {
         pendingEnterEntityIDs.Add(entity.id);
         return;
     }
     SceneEntityObject obj = SceneEntityObjectManager.CreateSceneEntityObject(entity);
 }
예제 #16
0
    public void set_moveSpeed(KBEngine.Entity entity, object v)
    {
        float fspeed = ((float)(Byte)v) / 10f;

        if (entity.renderObj != null)
        {
            ((UnityEngine.GameObject)entity.renderObj).GetComponent <GameEntity>().speed = fspeed;
        }
    }
예제 #17
0
파일: World.cs 프로젝트: m969/balls_client
 public void OnMoveSpeedChanged(KBEngine.Entity entity)
 {
     Debug.Log("World:OnMoveSpeedChanged " + (entity as Avatar).moveSpeed + " " + entity.className + " " + entity.id);
     if (entity.renderObj == null)
     {
         return;
     }
     (entity.renderObj as GameObject).GetComponent <AvatarView>().speed = (entity as Avatar).moveSpeed;
 }
예제 #18
0
파일: World.cs 프로젝트: m969/balls_client
    public void OnMainAvatarEnterWorld(KBEngine.Entity entity)
    {
        Debug.Log("World:OnMainAvatarEnterWorld");
        var avatarObj = Instantiate(mainAvatarPrefab);

        entity.renderObj = avatarObj;
        avatarObj.GetComponent <AvatarView>().avatar = entity as Avatar;
        avatarObj.GetComponent <AvatarView>().speed  = (entity as Avatar).moveSpeed;
    }
예제 #19
0
    public void set_modelID(KBEngine.Entity entity, object v)
    {
        Byte modelID = ((Byte)v);

        if (entity.renderObj != null)
        {
            ((UnityEngine.GameObject)entity.renderObj).GetComponent <GameEntity>().set_modelID(modelID);
        }
    }
예제 #20
0
    //更新玩家显示等级
    public void updatePlayerLayer(KBEngine.Entity entity, object v)
    {
        int l = (int)v;

        if (entity.renderObj != null)
        {
            ((GameObject)entity.renderObj).transform.GetComponent <SpriteRenderer>().sortingOrder = l;
        }
    }
예제 #21
0
 public void onLeaveWorld(KBEngine.Entity entity)
 {
     if (entity.renderObj == null)
     {
         return;
     }
     UnityEngine.GameObject.Destroy((UnityEngine.GameObject)entity.renderObj);
     entity.renderObj = null;
 }
예제 #22
0
 public void set_bodyPower(KBEngine.Entity entity, object v)
 {
     v = entity.getDefinedProperty("bodyPower");
     PlayerMediator.playerInfo.bodyPower = int.Parse(v.ToString());
     if (GoldMediator.goldMediator != null)
     {
         GoldMediator.goldMediator.GoldChangeCall("bodyPower");
     }
 }
예제 #23
0
    public void set_modelScale(KBEngine.Entity entity, object v)
    {
        float modelScale = ((float)v);

        if (entity.renderObj != null)
        {
            ((UnityEngine.GameObject)entity.renderObj).GetComponent <GameEntity>().set_modelScale(modelScale);
        }
    }
예제 #24
0
 public void otherAvatarOnJump(KBEngine.Entity entity)
 {
     if (entity.renderObj != null)
     {
         SceneEntityObject seo = ((SceneEntityObject)entity.renderObj);
         seo.stopPlayAnimation("");
         seo.playJumpAnimation();
     }
 }
예제 #25
0
파일: World.cs 프로젝트: VirtuaIRiot/Game
    public void set_modelScale(KBEngine.Entity entity, Byte v)
    {
        if (gameObject == null || entity.renderObj == null)
        {
            return;
        }

        Debug.Log("World::set_modelScale: " + entity.id + ",v:" + v);
    }
예제 #26
0
 public void set_slogan(KBEngine.Entity entity, object v)
 {
     v = entity.getDefinedProperty("slogan");
     PlayerMediator.playerInfo.slogan = v.ToString();
     if (GUIManager.HasView("playerpanel"))
     {
         PlayerMediator.playerMediator.panel.slogan.text = PlayerMediator.playerInfo.slogan;
     }
 }
예제 #27
0
 public void set_modelScale(KBEngine.Entity entity, object v)
 {
     if (entity.renderObj != null)
     {
         GameEntity e = ((UnityEngine.GameObject)entity.renderObj).GetComponent <GameEntity>();
         e.modelScale = (byte)v;
         Debug.LogWarning("[SCALE]:" + e.name + "_" + e.modelScale);
     }
 }
예제 #28
0
 public void set_euroBuyTimes(KBEngine.Entity entity, object v)
 {
     v = entity.getDefinedProperty("euroBuyTimes");
     PlayerMediator.playerInfo.euroBuyTimes = int.Parse(v.ToString());
     if (PowerMediator.powerMediator != null)
     {
         PowerMediator.powerMediator.UpdateTimes();
     }
 }
예제 #29
0
 void on_gobackreliveClick(UnityEngine.GameObject item)
 {
     Common.DEBUG_MSG("on_gobackreliveClick: " + item.name);
     KBEngine.Entity player = KBEngineApp.app.player();
     if (player != null && player.className == "Avatar")
     {
         ((KBEngine.Avatar)player).relive(0);
         hideRelivePanel();
     }
 }
예제 #30
0
    public void set_direction(KBEngine.Entity entity)
    {
        if (entity.renderObj == null)
        {
            return;
        }

        ((UnityEngine.GameObject)entity.renderObj).GetComponent <GameEntity>().destDirection =
            new Vector3(entity.direction.y, entity.direction.z, entity.direction.x);
    }