Exemplo n.º 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();
        }
    }
Exemplo n.º 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);
        }
    }
Exemplo n.º 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);
        }
    }
Exemplo n.º 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);
    }
Exemplo n.º 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
            );
        }
    }
Exemplo n.º 6
0
 public void otherAvatarOnJump(KBEngine.Entity entity)
 {
     Debug.Log("otherAvatarOnJump: " + entity.id);
     if (entity.renderObj != null)
     {
         ((UnityEngine.GameObject)entity.renderObj).GetComponent <GameEntity>().OnJump();
     }
 }
Exemplo n.º 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);
     }
 }
Exemplo n.º 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);
    }
Exemplo n.º 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);
 }
Exemplo n.º 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;
    }
Exemplo n.º 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);
     }
 }
Exemplo n.º 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);
        }
    }
Exemplo n.º 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();
     }
 }
Exemplo n.º 14
0
    public void onControlled(KBEngine.Entity entity, bool isControlled)
    {
        if (entity.renderObj == null)
        {
            return;
        }

        Debug.Log("onControlled: " + entity.isControlled);
    }
Exemplo n.º 15
0
 public void onEnterWorld(KBEngine.Entity entity)
 {
     if (enterSpace == false)
     {
         pendingEnterEntityIDs.Add(entity.id);
         return;
     }
     SceneEntityObject obj = SceneEntityObjectManager.CreateSceneEntityObject(entity);
 }
Exemplo n.º 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;
        }
    }
Exemplo n.º 17
0
 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;
 }
Exemplo n.º 18
0
    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;
    }
Exemplo n.º 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);
        }
    }
Exemplo n.º 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;
        }
    }
Exemplo n.º 21
0
 public void onLeaveWorld(KBEngine.Entity entity)
 {
     if (entity.renderObj == null)
     {
         return;
     }
     UnityEngine.GameObject.Destroy((UnityEngine.GameObject)entity.renderObj);
     entity.renderObj = null;
 }
Exemplo n.º 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");
     }
 }
Exemplo n.º 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);
        }
    }
Exemplo n.º 24
0
 public void otherAvatarOnJump(KBEngine.Entity entity)
 {
     if (entity.renderObj != null)
     {
         SceneEntityObject seo = ((SceneEntityObject)entity.renderObj);
         seo.stopPlayAnimation("");
         seo.playJumpAnimation();
     }
 }
Exemplo n.º 25
0
    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);
    }
Exemplo n.º 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;
     }
 }
Exemplo n.º 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);
     }
 }
Exemplo n.º 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();
     }
 }
Exemplo n.º 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();
     }
 }
Exemplo n.º 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);
    }