コード例 #1
0
        public void PlaceFurniture(GameObject gameObject, TechType techType, Vector3 itemPosition, Quaternion quaternion)
        {
            if (!Builder.isPlacing) //prevent possible echoing
            {
                return;
            }

            NitroxId id = NitroxEntity.GetId(gameObject);

            Optional <NitroxId> subId = Optional <NitroxId> .Empty();

            SubRoot sub = Player.main.currentSub;

            if (sub != null)
            {
                subId = Optional <NitroxId> .Of(NitroxEntity.GetId(sub.gameObject));
            }

            Transform camera = Camera.main.transform;
            Optional <RotationMetadata> rotationMetadata = Optional <RotationMetadata> .Empty();

            BasePiece      basePiece       = new BasePiece(id, itemPosition, quaternion, camera.position, camera.rotation, techType.Model(), subId, true, rotationMetadata);
            PlaceBasePiece placedBasePiece = new PlaceBasePiece(basePiece);

            packetSender.Send(placedBasePiece);
        }
コード例 #2
0
        public void PlaceFurniture(GameObject gameObject, TechType techType, Vector3 itemPosition, Quaternion quaternion)
        {
            if (!Builder.isPlacing) //prevent possible echoing
            {
                return;
            }

            string guid = GuidHelper.GetGuid(gameObject);

            Optional <string> subGuid = Optional <string> .Empty();

            SubRoot sub = Player.main.currentSub;

            if (sub != null)
            {
                subGuid = Optional <string> .Of(GuidHelper.GetGuid(sub.gameObject));
            }

            Transform camera = Camera.main.transform;

            BasePiece      basePiece       = new BasePiece(guid, itemPosition, quaternion, camera.position, camera.rotation, techType, subGuid, true);
            PlaceBasePiece placedBasePiece = new PlaceBasePiece(basePiece);

            packetSender.Send(placedBasePiece);
        }
コード例 #3
0
ファイル: PacketSender.cs プロジェクト: evanmalmud/Nitrox
        public void PlaceBasePiece(String guid, String techType, Vector3 itemPosition, Quaternion quaternion, Transform camera, Optional <String> parentBaseGuid)
        {
            PlaceBasePiece placedBasePiece = new PlaceBasePiece(PlayerId, guid, ApiHelper.Vector3(itemPosition), ApiHelper.Quaternion(quaternion), ApiHelper.Transform(camera), techType, parentBaseGuid);

            Send(placedBasePiece);
            Console.WriteLine(placedBasePiece);
        }
コード例 #4
0
ファイル: Building.cs プロジェクト: EmidioMata/1.3
        public void PlaceFurniture(GameObject gameObject, TechType techType, Vector3 itemPosition, Quaternion quaternion)
        {
            if (!Builder.isPlacing) //prevent possible echoing
            {
                return;
            }

            NitroxId id       = NitroxEntity.GetId(gameObject);
            NitroxId parentId = null;

            SubRoot sub = Player.main.currentSub;

            if (sub != null)
            {
                parentId = NitroxEntity.GetId(sub.gameObject);
            }
            else
            {
                Base playerBase = gameObject.GetComponentInParent <Base>();

                if (playerBase != null)
                {
                    parentId = NitroxEntity.GetId(playerBase.gameObject);
                }
            }

            Transform      camera          = Camera.main.transform;
            BasePiece      basePiece       = new BasePiece(id, itemPosition.ToDto(), quaternion.ToDto(), camera.position.ToDto(), camera.rotation.ToDto(), techType.ToDto(), Optional.OfNullable(parentId), true, Optional.Empty);
            PlaceBasePiece placedBasePiece = new PlaceBasePiece(basePiece);

            packetSender.Send(placedBasePiece);
        }
コード例 #5
0
ファイル: Building.cs プロジェクト: PlayTerik/Nitrox
        public void PlaceBasePiece(ConstructableBase constructableBase, Base targetBase, TechType techType, Quaternion quaternion)
        {
            if (!Builder.isPlacing) //prevent possible echoing
            {
                return;
            }

            String    guid           = GuidHelper.GetGuid(constructableBase.gameObject);
            String    parentBaseGuid = (targetBase == null) ? null : GuidHelper.GetGuid(targetBase.gameObject);
            Vector3   itemPosition   = constructableBase.gameObject.transform.position;
            Transform camera         = Camera.main.transform;

            PlaceBasePiece placedBasePiece = new PlaceBasePiece(packetSender.PlayerId, guid, itemPosition, quaternion, camera.position, camera.rotation, techType, Optional <String> .OfNullable(parentBaseGuid));

            packetSender.Send(placedBasePiece);
        }
コード例 #6
0
        public void PlaceBasePiece(BaseGhost baseGhost, ConstructableBase constructableBase, Base targetBase, TechType techType, Quaternion quaternion)
        {
            if (!Builder.isPlacing) //prevent possible echoing
            {
                return;
            }

            NitroxId  id             = NitroxEntity.GetId(constructableBase.gameObject);
            NitroxId  parentBaseId   = (targetBase == null) ? null : NitroxEntity.GetId(targetBase.gameObject);
            Vector3   placedPosition = constructableBase.gameObject.transform.position;
            Transform camera         = Camera.main.transform;
            Optional <RotationMetadata> rotationMetadata = rotationMetadataFactory.From(baseGhost);

            BasePiece      basePiece       = new BasePiece(id, placedPosition, quaternion, camera.position, camera.rotation, techType.Model(), Optional <NitroxId> .OfNullable(parentBaseId), false, rotationMetadata);
            PlaceBasePiece placedBasePiece = new PlaceBasePiece(basePiece);

            packetSender.Send(placedBasePiece);
        }
コード例 #7
0
ファイル: Building.cs プロジェクト: valdeman88/Nitrox
        public void PlaceBasePiece(BaseGhost baseGhost, ConstructableBase constructableBase, Base targetBase, TechType techType, Quaternion quaternion)
        {
            if (!Builder.isPlacing) //prevent possible echoing
            {
                return;
            }

            string    guid           = GuidHelper.GetGuid(constructableBase.gameObject);
            string    parentBaseGuid = (targetBase == null) ? null : GuidHelper.GetGuid(targetBase.gameObject);
            Vector3   placedPosition = constructableBase.gameObject.transform.position;
            Transform camera         = Camera.main.transform;
            Optional <RotationMetadata> rotationMetadata = RotationMetadata.From(baseGhost);

            BasePiece      basePiece       = new BasePiece(guid, placedPosition, quaternion, camera.position, camera.rotation, techType, Optional <string> .OfNullable(parentBaseGuid), false, rotationMetadata);
            PlaceBasePiece placedBasePiece = new PlaceBasePiece(basePiece);

            packetSender.Send(placedBasePiece);
        }
コード例 #8
0
ファイル: Building.cs プロジェクト: EmidioMata/1.3
        public void PlaceBasePiece(BaseGhost baseGhost, ConstructableBase constructableBase, Base targetBase, TechType techType, Quaternion quaternion)
        {
            if (!Builder.isPlacing) //prevent possible echoing
            {
                return;
            }

            NitroxId id           = NitroxEntity.GetId(constructableBase.gameObject);
            NitroxId parentBaseId = null;

            if (targetBase != null)
            {
                parentBaseId = NitroxEntity.GetId(targetBase.gameObject);
            }
            else if (constructableBase != null)
            {
                Base playerBase = constructableBase.gameObject.GetComponentInParent <Base>();

                if (playerBase != null)
                {
                    parentBaseId = NitroxEntity.GetId(playerBase.gameObject);
                }
            }

            if (parentBaseId == null)
            {
                Base playerBase = baseGhost.gameObject.GetComponentInParent <Base>();

                if (playerBase != null)
                {
                    parentBaseId = NitroxEntity.GetId(playerBase.gameObject);
                }
            }

            Vector3   placedPosition = constructableBase.gameObject.transform.position;
            Transform camera         = Camera.main.transform;
            Optional <RotationMetadata> rotationMetadata = rotationMetadataFactory.From(baseGhost);

            BasePiece      basePiece       = new BasePiece(id, placedPosition.ToDto(), quaternion.ToDto(), camera.position.ToDto(), camera.rotation.ToDto(), techType.ToDto(), Optional.OfNullable(parentBaseId), false, rotationMetadata);
            PlaceBasePiece placedBasePiece = new PlaceBasePiece(basePiece);

            packetSender.Send(placedBasePiece);
        }
コード例 #9
0
ファイル: Building.cs プロジェクト: MrPurple6411/Nitrox
        public void PlaceFurniture(GameObject gameObject, TechType techType, Vector3 itemPosition, Quaternion quaternion)
        {
            if (!Builder.isPlacing) //prevent possible echoing
            {
                return;
            }

            NitroxId id       = NitroxEntity.GetId(gameObject);
            NitroxId parentId = null;

            SubRoot sub = Player.main.currentSub;

            if (sub != null)
            {
                parentId = NitroxEntity.GetId(sub.gameObject);
            }
            else
            {
                Base playerBase = gameObject.GetComponentInParent <Base>();

                if (playerBase != null)
                {
                    parentId = NitroxEntity.GetId(playerBase.gameObject);
                }
            }

            // Leverage local position when in a cyclops as items must be relative.
            bool       inCyclops = (sub != null && sub.isCyclops);
            Vector3    position  = (inCyclops) ? gameObject.transform.localPosition : itemPosition;
            Quaternion rotation  = (inCyclops) ? gameObject.transform.localRotation : quaternion;

            Transform      camera          = Camera.main.transform;
            BasePiece      basePiece       = new BasePiece(id, position.ToDto(), rotation.ToDto(), camera.position.ToDto(), camera.rotation.ToDto(), techType.ToDto(), Optional.OfNullable(parentId), true, Optional.Empty);
            PlaceBasePiece placedBasePiece = new PlaceBasePiece(basePiece);

            packetSender.Send(placedBasePiece);
        }