예제 #1
0
            void Update()
            {
                if (isDisabled)
                {
                    return;
                }

                timeTaken = timeTaken + UnityEngine.Time.deltaTime;
                float single = Mathf.InverseLerp(0f, timeToTake, timeTaken);

                modifiedRadius = initialRadius * (1 - single);

                innerSphere.currentRadius = (initialRadius * 2) * (1 - single);
                //outerSphere.currentRadius = ((initialRadius * 2) * (1 - single)) + bufferSize;

                innerSphere.SendNetworkUpdateImmediate();
                //outerSphere.SendNetworkUpdateImmediate();

                innerCollider.radius = modifiedRadius;
                //radTrigger.radiationSize = modifiedRadius + bufferSize;

                if (modifiedRadius <= targetRadius)
                {
                    isDisabled = true;
                    RadzoneFinished();
                }
            }
        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);
        }