Example #1
0
 public void BeginPlaceBlock(BaseBuildingBlock block)
 {
     hoveringBlock     = block;
     lastRay           = default;
     lastMousePos      = default;
     rayDidHit         = false;
     objectToPlace     = Instantiate(block.prefab).transform;
     currentMeshExtend = objectToPlace.GetComponent <MeshFilter>().sharedMesh.bounds.extents;
     toPlaceRenderer   = objectToPlace.GetComponent <MeshRenderer>();
     originalMat       = toPlaceRenderer.sharedMaterial;
     enabled           = true;
 }
Example #2
0
        public Entity(ProtoBuf.Entity proto)
        {
            protobuf = proto;
            if (proto.basePlayer != null)
            {
                player = new BasePlayer(proto.basePlayer);
            }
            if (proto.resource != null)
            {
                resource = new BaseResource(proto.resource);
            }
            if (proto.buildingBlock != null)
            {
                buildingBlock = new BaseBuildingBlock(proto.buildingBlock);
            }
            if (proto.worldItem != null)
            {
                worldItem = new BaseItem(proto.worldItem.item);
            }
            if (proto.environment != null)
            {
                environment = new BaseEnvironment(proto.environment);
            }
            if (proto.codeLock != null)
            {
                codeLock = new BaseCodeLock(proto.codeLock);
            }
            if (proto.buildingPrivilege != null)
            {
                buildingPrivilege = new BaseBuildingPrivilege(proto.buildingPrivilege);
            }
            if (proto.storageBox != null)
            {
                storageBoxContents = new BaseItem.BaseItemContainer(proto.storageBox.contents);
            }
            if (proto.baseProjectile != null)
            {
                projectile = new BaseProjectile(proto.baseProjectile);
            }

            if (IsPlayer)
            {
                players.Add(this);
            }
        }