Beispiel #1
0
    void Stick(IRopable ropable, Vector2 position)
    {
        GetComponent<Rigidbody2D>().velocity = new Vector2(0f, 0f);

        ropable.Roped(this, position);

        ropeTarget = ropable;

        stickInfo = new S2C.RopeStickInfo(true, ropable.GetRopableID(), position);
        GetComponent<NetworkView>().RPC("SetRopeStuck", RPCMode.Others, stickInfo.SerializeToBytes());
    }
Beispiel #2
0
    void OnSetRopeStuck(S2C.RopeStickInfo info)
    {
        stickInfo = info;

        if (stickInfo.isSticked == false)
            return;

        IRopable ropable;
        switch(info.m_RID.m_type)
        {
            case ObjectType.TILE:
                ropable = TileManager.Inst.Get((ushort)info.m_RID.m_ID);
                break;

            case ObjectType.BUILDING:
                ropable = BuildingManager.Inst.Get((ushort)info.m_RID.m_ID);
                break;

            case ObjectType.PLAYER:
                ropable = PlayerManager.Inst.Get((int)info.m_RID.m_ID);
                break;

                /*
            case ObjectType.PROJECTILE:
                ropable = ProjectileManager.Inst.Get(info.m_RID.m_ID);
                break;
        */
            default:
                return;
        }

        transform.position = stickInfo.position;
        GetComponent<Rigidbody2D>().velocity = new Vector2(0f, 0f);

        ropable.Roped(this, info.position);

        ropeTarget = ropable;

        ropeSource = PlayerManager.Inst.Get(owner);
    }
Beispiel #3
0
 void SetRopeStuck(byte[] pckData, NetworkMessageInfo info)
 {
     //ServerCheck
     S2C.RopeStickInfo stickInfo = new S2C.RopeStickInfo();
     stickInfo.DeserializeFromBytes(pckData);
     OnSetRopeStuck(stickInfo);
 }
Beispiel #4
0
    protected override void OnInit()
    {
        if (Network.isServer)
        {
            PlayerManager.Inst.Get(owner).OnFireRope(this);
            ropeSource = PlayerManager.Inst.Get(owner);

            stickInfo = new S2C.RopeStickInfo();
            stickInfo.isSticked = false;
        }
    }