Esempio n. 1
0
        private PlayerInfoMsg getInfoMsg(long id, string name, int roleType, BaseEntity role = null)
        {
            pb.PlayerInfoMsg rtn = new pb.PlayerInfoMsg();
            rtn.playerId = id;
            rtn.name     = name;
            rtn.resName  = @"AssetBundle\Prefabs\model\rolemine\role_mine";
            //pos
            pb.PBVector2 pos = new pb.PBVector2();
            pos.x   = role != null ? (long)(role.DyBox.centerX * 1000) : -3 * 1000;
            pos.y   = role != null ? (long)(role.DyBox.centerY * 1000) : -3 * 1000;
            rtn.pos = pos;
            //move box
            PBVector2 moveBox = new PBVector2();

            moveBox.x   = (long)(2 * 1000);
            moveBox.y   = (long)(0.4f * 1000);
            rtn.moveBox = moveBox;
            //height
            rtn.height = 0;
            //speed
            rtn.speed = (long)(3 * 1000);
            //jumpSpeed
            rtn.jumpSpeed = (long)(4 * 1000);
            //缩放
            PBVector3 scale = new PBVector3();

            scale.x   = (long)(0.5f * 1000);
            scale.y   = (long)(0.5f * 1000);
            scale.z   = (long)(1 * 1000);
            rtn.scale = scale;
            //role Type
            rtn.roleType = roleType;
            //hit box
            PBVector2 hitBox = new PBVector2();

            hitBox.x   = (long)(2.5f * 1000);
            hitBox.y   = (long)(3.5f * 1000);
            rtn.hitBox = hitBox;
            //look flag
            rtn.lookFlag = role != null ? role.lookFlag == LookFlag.Right ? 1 : 0 : 1;
            return(rtn);
        }
Esempio n. 2
0
    //serialization constructor
    //	protected SavedState (SerializationInfo info, StreamingContext context)
    //	{
    //		try {
    //			this.position = (SerVector3)info.GetValue ("position", typeof(SerVector3));
    //			this.rotation = (SerQuaternion)info.GetValue ("rotation", typeof(SerQuaternion));
    //		} catch {
    //			//not available if used an older version to save the replay, ignore
    //		}
    //		this.localPosition = (SerVector3)info.GetValue ("localPosition", typeof(SerVector3));
    //		this.localRotation = (SerQuaternion)info.GetValue ("localRotation", typeof(SerQuaternion));
    //
    //		emittingParticles = info.GetBoolean ("emittingParticles");
    //		isActive = info.GetBoolean ("isActive");
    //	}

    //as this is not derived from MonoBehaviour, we have a constructor
    public SavedState(GameObject go)
    {
        if (go != null)
        {
            if (go.GetComponent <ParticleEmitter> ())
            {
                emittingParticles = go.GetComponent <ParticleEmitter> ().emit;
            }

            this.position      = go.transform.position;
            this.rotation      = go.transform.rotation;
            this.localPosition = go.transform.localPosition;
            this.localRotation = go.transform.localRotation;
            this.isActive      = go.activeInHierarchy;
        }
        else
        {
            this.position      = Vector3.zero;
            this.rotation      = Quaternion.identity;
            this.localPosition = Vector3.zero;
            this.localRotation = Quaternion.identity;
            this.isActive      = false;
        }
    }
Esempio n. 3
0
 public bool isDifferentTo(PBVector3 i)
 {
     return(x != i.x || y != i.y || z != i.z);
 }