コード例 #1
0
        private void GiveBackpackWorldmodel(BasePlayer player)
        {
            SphereEntity sph = GameManager.server.CreateEntity(spherePrefab, player.eyes.position, player.transform.rotation) as SphereEntity;

            sph.Spawn();
            sph.lerpSpeed     = 0f;
            sph.currentRadius = 0.6f;
            sph.SetParent(player, "spine3");
            sph.transform.localPosition = new Vector3(-0.08f, 0, 0);
            sph.transform.rotation      = Quaternion.Euler(0, 270, 180);
            DroppedItemContainer gObj = GameManager.server.CreateEntity(itemWorldModel, player.transform.position) as DroppedItemContainer;

            //PrintComponents(sph);
            gObj.ResetRemovalTime(9999999999999);
            //gObj.transform.localPosition = new Vector3(0, 0, 0);
            //gObj.transform.rotation = Quaternion.Euler(0, 270, 180);
            gObj.Spawn();
            UnityEngine.Object.DestroyImmediate(gObj.GetComponent <Rigidbody>());
            gObj.SetParent(sph);
            gObj.transform.localPosition = new Vector3(0, 0, 0);
            gObj.SendNetworkUpdateImmediate();
            timer.Once(1.0f, () => {
                gObj.SetParent(player, "spine3");
                gObj.transform.localPosition = new Vector3(-0.08f, 0.0f, 0);
                gObj.transform.rotation      = Quaternion.Euler(0, 270, 180);
                timer.Once(0.2f, () => {
                    sph?.Kill();
                });
            });
        }
コード例 #2
0
        void AddSearchLight(MiniCopter copter)
        {
            SphereEntity sph = (SphereEntity)GameManager.server.CreateEntity(spherePrefab, copter.transform.position, new Quaternion(0, 0, 0, 0), true);

            DestroyMeshCollider(sph);
            DestroyGroundComp(sph);
            sph.Spawn();
            sph.SetParent(copter);
            sph.transform.localPosition = new Vector3(0, -100, 0);
            SearchLight searchLight = GameManager.server.CreateEntity(searchLightPrefab, sph.transform.position) as SearchLight;

            DestroyMeshCollider(searchLight);
            DestroyGroundComp(searchLight);
            searchLight.Spawn();
            searchLight.GetComponent <StorageContainer>().isLootable = false;
            searchLight.SetFlag(BaseEntity.Flags.Reserved5, true, false, true);
            searchLight.SetParent(sph);
            searchLight.transform.localPosition = new Vector3(0, 0, 0);
            searchLight.transform.localRotation = Quaternion.Euler(new Vector3(20, 0, 180));
            searchLight.transform.localRotation = Quaternion.Euler(new Vector3(20, 0, 0));
            searchLight.transform.localRotation = Quaternion.Euler(new Vector3(20, 0, 180));
            Puts(searchLight.eyePoint.transform.position.ToString());
            searchLight._maxHealth     = 99999999f;
            searchLight._health        = 99999999f;
            searchLight.pickup.enabled = false;
            searchLight.isLockable     = true;
            searchLight.SendNetworkUpdate();
            sph.transform.localScale += new Vector3(0.9f, 0, 0);
            sph.LerpRadiusTo(0.1f, 10f);
            timer.Once(3f, () => {
                sph.transform.localPosition = new Vector3(0, 0.24f, 1.8f);
            });
            sph.SendNetworkUpdateImmediate();
            //PrintComponents(searchLight);
        }
コード例 #3
0
        private SearchLight TryDeploySearchLight(Drone drone)
        {
            if (DeployLightWasBlocked(drone))
            {
                return(null);
            }

            // Spawn the search light below the map initially while the resize is performed.
            SphereEntity sphereEntity = GameManager.server.CreateEntity(SpherePrefab, SphereEntityInitialLocalPosition) as SphereEntity;

            if (sphereEntity == null)
            {
                return(null);
            }

            // Fix the issue where leaving the area and returning would not recreate the sphere and its children on clients.
            sphereEntity.globalBroadcast = false;

            sphereEntity.currentRadius = 0.1f;
            sphereEntity.lerpRadius    = 0.1f;

            sphereEntity.SetParent(drone);
            sphereEntity.Spawn();

            var         localRotation = Quaternion.Euler(_pluginConfig.SearchLight.DefaultAngle - 90 % 350, SearchLightYAxisRotation, 0);
            SearchLight searchLight   = GameManager.server.CreateEntity(SearchLightPrefab, SearchLightLocalPosition, localRotation) as SearchLight;

            if (searchLight == null)
            {
                return(null);
            }

            SetupSearchLight(searchLight);

            searchLight.SetParent(sphereEntity);
            searchLight.Spawn();
            Interface.CallHook("OnDroneSearchLightDeployed", drone, searchLight);

            timer.Once(3, () =>
            {
                if (sphereEntity != null)
                {
                    sphereEntity.transform.localPosition = SphereEntityLocalPosition;
                }
            });

            return(searchLight);
        }
コード例 #4
0
        private static SphereEntity SpawnSphereEntity(Drone drone)
        {
            SphereEntity sphereEntity = GameManager.server.CreateEntity(SpherePrefab, SphereEntityLocalPosition) as SphereEntity;

            if (sphereEntity == null)
            {
                return(null);
            }

            SetupSphereEntity(sphereEntity);
            sphereEntity.currentRadius = TurretScale;
            sphereEntity.lerpRadius    = TurretScale;
            sphereEntity.SetParent(drone);
            sphereEntity.Spawn();

            return(sphereEntity);
        }