Beispiel #1
0
    public void recRelief(KBEngine.Role e, ReliefType type)
    {
        if (e.renderObj == null)
        {
            return;
        }

        GameObject  player = e.renderObj as GameObject;
        CombatProps cp     = player.GetComponent <CombatProps>();

        switch (type)
        {
        case ReliefType.Frozen:
            cp.outFrozenDBuff();
            break;

        case ReliefType.SpeedUp:
            cp.outSpeedUpBuff();
            break;

        case ReliefType.Sleep:
            cp.outSleepDBuff();
            break;

        case ReliefType.Mess:
            cp.outMessDBuff();
            break;
        }
    }
Beispiel #2
0
    public void set_atk(KBEngine.Role e)
    {
        process _p = (_e) =>
        {
            _e.SyncAtk(e.atk);
        };

        SAFE_PROCESS(e, _p);
    }
Beispiel #3
0
    //===================================
    // Desc: ashe hero ani sync
    //===================================
    public void set_die(KBEngine.Role e)
    {
        process _p = (_e) =>
        {
            _e.SyncDie(e.die > 0);
        };

        SAFE_PROCESS(e, _p);
    }
Beispiel #4
0
    public void set_run(KBEngine.Role e)
    {
        process _p = (_e) =>
        {
            _e.SyncRun(e.run > 0);
        };

        SAFE_PROCESS(e, _p);
    }
Beispiel #5
0
    string getHeroName()
    {
        string name = "";

        KBEngine.Role player = (KBEngine.Role)gameObject.GetComponent <SyncPosRot>().entity;
        if (player != null)
        {
            name = player.role_name;
        }
        return(name);
    }
Beispiel #6
0
    public void recSpeedUp(KBEngine.Role e, float speed)
    {
        if (e.renderObj == null)
        {
            return;
        }

        GameObject  player = e.renderObj as GameObject;
        CombatProps cp     = player.GetComponent <CombatProps>();

        cp.inSpeedUpBuff();

        Instantiate(speedUpEffect, player.transform.position, player.transform.rotation, player.transform);
    }
Beispiel #7
0
    public void recTeleport(KBEngine.Role e)
    {
        if (e.isPlayer())
        {
            return;
        }

        if (e.renderObj == null)
        {
            return;
        }
        GameObject player = e.renderObj as GameObject;

        Instantiate(teleportEffect, player.transform.position, player.transform.rotation, player.transform);
    }
Beispiel #8
0
    //=================================================================
    //Combat rec here
    //=================================================================
    public void recAttack(KBEngine.Role e, int attackType, float damage)
    {
        if (e.renderObj == null)
        {
            return;
        }

        GameObject player = e.renderObj as GameObject;
        GameObject dp     = (GameObject)Instantiate(damagePopupObliPref, player.transform.position, Quaternion.identity);

        dp.GetComponent <ValuePopup>().m_Player = player;
        dp.GetComponent <ValuePopup>().m_Value  = (int)damage;
        CombatProps cp = player.GetComponent <CombatProps>();

        if (cp == null)
        {
            return;
        }

        switch ((AttackType)attackType)
        {
        case AttackType.Normal:
            break;

        case AttackType.Frozen:
            if (!cp.isInFrozenDBuff)
            {
                cp.inFrozenDBuff();
            }
            break;

        case AttackType.Strong:
            if (!cp.isSleep())
            {
                Instantiate(sleepEffect, player.transform.position, player.transform.rotation, player.transform);
                cp.inSleepDBuff();
            }
            break;

        case AttackType.Shadow:
            if (!cp.isMess())
            {
                Instantiate(messEffect, player.transform.position, player.transform.rotation, player.transform);
                cp.inMessDBuff();
            }
            break;
        }
    }
Beispiel #9
0
    Transform getShotTrans(GameObject master)
    {
        Transform shotPoint = master.transform;

        KBEngine.Role role = (KBEngine.Role)master.GetComponent <SyncPosRot>().entity;
        switch (role.career)
        {
        case 1:
            shotPoint = master.GetComponent <Ashe>().shotTrans;
            break;

        case 2:
            shotPoint = master.GetComponent <Ali>().shotTrans;
            break;
        }
        return(shotPoint);
    }
Beispiel #10
0
    public void onRoleEnterWorld(UInt64 rndUUID, Int32 eid, KBEngine.Role entity)
    {
        Debug.Log("当前玩家[" + entity.id + "]进入游戏世界...");

        //instantiate
        float y = entity.position.y;

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

        Vector3    pos    = new Vector3(entity.position.x, y, entity.position.z);
        GameObject hero   = Resources.Load("Prefabs/Heros/" + entity.role_name) as GameObject;
        GameObject player = Instantiate(hero, pos, entity.rotation) as GameObject;

        entity.renderObj = player;

        //set init props
        set_position(entity);
        set_direction(entity);

        //set sync entity
        player.GetComponent <SyncPosRot>().entity  = entity;
        player.GetComponent <SyncPosRot>().enabled = true;

        //set local controll
        bool isPlayer = entity.isPlayer();

        player.GetComponent <SyncPosRot>().isLocalPlayer = isPlayer;
        player.GetComponent <BloodHUD>().enabled         = !isPlayer;
        player.GetComponent <RoleHUD>().enabled          = isPlayer;
        getPlayerController(entity).isLocalPlayer        = isPlayer;

        if (isPlayer)
        {
            player.tag = "localPlayer";
            loadRoleSkillIcon(entity);
        }
        else
        {
            player.tag = "nonLocalPlayer";
        }
    }
Beispiel #11
0
    PlayerController getPlayerController(KBEngine.Role e)
    {
        GameObject       obj = (GameObject)e.renderObj;
        PlayerController _e  = null;

        if (obj != null)
        {
            switch (e.career)
            {
            case 1:
                _e = obj.GetComponent <Ashe>();
                break;

            case 2:
                _e = obj.GetComponent <Ali>();
                break;
            }
        }
        return(_e);
    }
Beispiel #12
0
    public void recShot(KBEngine.Role e, Byte res, Double timestamp)
    {
        if (e.isPlayer())
        {
            return;
        }

        if (res == 0)
        {
            if (othersArrowsDic.ContainsKey(timestamp))
            {
                List <GameObject> otherArrows = othersArrowsDic[timestamp];
                for (int i = 0; i < otherArrows.Count; i++)
                {
                    otherArrows[i].GetComponent <Renderer>().enabled = true;
                }
                otherArrows.Clear();
                othersArrowsDic.Remove(timestamp);
            }
        }
    }
Beispiel #13
0
    public void recCure(KBEngine.Role e, int cureType, float hp)
    {
        if (e.renderObj == null)
        {
            return;
        }

        GameObject player = e.renderObj as GameObject;
        GameObject dp     = (GameObject)Instantiate(curePopupPref, player.transform.position, Quaternion.identity);

        dp.GetComponent <ValuePopup>().m_Player = player;
        dp.GetComponent <ValuePopup>().m_Value  = (int)hp;

        switch ((CureType)cureType)
        {
        case CureType.Normal:
            Instantiate(cureNormalEffect, player.transform.position, player.transform.rotation, player.transform);
            break;

        case CureType.Bless:
            break;
        }
    }
Beispiel #14
0
    public void onRoleEnterWorld(UInt64 rndUUID, Int32 eid, KBEngine.Role entity)
    {
        Debug.Log("当前玩家[" + entity.id + "]进入游戏世界...");

        //instantiate
        float y = entity.position.y;

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

        Vector3    pos    = new Vector3(entity.position.x, y, entity.position.z);
        GameObject player = Instantiate(playerPrefab, pos, entity.rotation) as GameObject;

        entity.renderObj = player;

        //set init props
        set_position(entity);
        set_direction(entity);
        set_entityName(entity);
        set_moveSpeed(entity);
        player.GetComponent <Renderer>().material.mainTexture = Resources.Load <Texture>("pic/" + ((Role)entity).career_name);

        //set sync entity
        player.GetComponent <SyncPosRot>().entity  = entity;
        player.GetComponent <SyncPosRot>().enabled = true;

        //set local controll
        if (entity.isPlayer())
        {
            ctrlCamera.GetComponent <GameInput>().m_Player   = player;
            ctrlCamera.GetComponent <GameInput>().enabled    = true;
            player.GetComponent <SyncPosRot>().isLocalPlayer = true;
        }
    }
Beispiel #15
0
    private void loadRoleSkillIcon(KBEngine.Role entity)
    {
        GameObject ui = Resources.Load("Prefabs/UI/Play_Canvas") as GameObject;

        ui = Instantiate(ui);

        //head
        Transform headBlood  = ui.transform.FindChild("HeadBlood");
        Transform frameImage = headBlood.transform.FindChild("Frame_Image");
        Transform head       = frameImage.FindChild("Head_Image");
        Sprite    headSp     = Resources.Load <Sprite>("ui/" + entity.role_name + "_circle");

        head.GetComponent <Image>().sprite = headSp;

        //skill
        Transform actionRight = ui.transform.FindChild("Action_Right");

        for (int i = 1; i <= skillCount; i++)
        {
            skillArr[i] = actionRight.FindChild("Skill" + i + "_C_Image");;
            Sprite skillSp = Resources.Load <Sprite>("Atlas/skill/" + entity.role_name + i);
            skillArr[i].GetComponent <Image>().sprite = skillSp;
        }
    }
Beispiel #16
0
    private void SAFE_PROCESS(KBEngine.Role e, process p)
    {
        GameObject obj = (GameObject)e.renderObj;

        if (obj != null)
        {
            PlayerController _e = null;
            switch (e.career)
            {
            case 1:
                _e = obj.GetComponent <Ashe>();
                break;

            case 2:
                _e = obj.GetComponent <Ali>();
                break;
            }

            if (_e != null)
            {
                p(_e);
            }
        }
    }
Beispiel #17
0
    public void recRelive(KBEngine.Role e, Vector3 relivePos)
    {
        if (e.renderObj == null)
        {
            return;
        }
        GameObject player = e.renderObj as GameObject;

        Transform dieTrans = player.transform;

        switch (e.career)
        {
        case 1:
            Ashe ashe = player.GetComponent <Ashe>();
            dieTrans = ashe.hipTrans;
            break;

        case 2:
            Ali ali = player.GetComponent <Ali>();
            dieTrans = ali.hipTrans;
            break;
        }
        Instantiate(dieEffect, dieTrans.position, player.transform.rotation, player.transform);
    }