예제 #1
0
 void OnEnable()
 {
     if (_spatialOsComponent == null)
     {
         _spatialOsComponent = GetComponent <LinkedEntityComponent>();
     }
 }
        private void OnEnable()
        {
            LinkedEntityComponent = GetComponent <LinkedEntityComponent>();
            origin = LinkedEntityComponent.Worker.Origin;

            client.OnLatestUpdate += OnClientUpdate;
        }
 protected void OnEnable()
 {
     _spatialOsComponent = GetComponent <LinkedEntityComponent>();
     desiredHeading      = transform.forward;
     // Initialize entity's gameobject transform from Position component values
     transform.position = PositionWriter.Data.Coords.ToUnityVector() + _spatialOsComponent.Worker.Origin;
 }
예제 #4
0
 private void OnEnable()
 {
     radius     = GetComponent <SphereCollider>().radius;
     turretHeal = healValueReader.Data.Value;
     StartCoroutine(nameof(DealDamage));
     LinkedEntityComponent lec = gameObject.GetComponent <LinkedEntityComponent>();
 }
 private void OnEnable()
 {
     _spatialOsComponent = GetComponent <LinkedEntityComponent>();
     // Initialize entity's gameobject transform from Position and Rotation component values
     transform.position = PositionWriter.Data.Coords.ToUnityVector() + _spatialOsComponent.Worker.Origin;
     myRigidbody.inertiaTensorRotation = Quaternion.identity;
 }
 private void OnEnable()
 {
     HealthReader.OnHealthModifiedEvent += OnHealthModified;
     HealthReader.OnRespawnEvent        += OnRespawn;
     spatial = GetComponent <LinkedEntityComponent>();
     SetPlayerState(PlayerState.LookingForTarget);
 }
예제 #7
0
 private void SendDoneCommand()
 {
     if (stateReader.Data.State != EState.IDLE)
     {
         LinkedEntityComponent entityInfo = GetComponent <LinkedEntityComponent>();
         TDoneReq doneReq;
         doneReq.Error = 0;
         stateCommandSender.SendDoneCommand(entityInfo.EntityId, doneReq);
     }
 }
        protected void OnEnable()
#endif
        {
            // Fetch styles
            enabledContent  = EditorGUIUtility.IconContent("sv_icon_dot3_pix16_gizmo");
            disabledContent = EditorGUIUtility.IconContent("sv_icon_dot0_pix16_gizmo");

            // Get type info
            script             = (MonoBehaviour)target;
            scriptType         = script.GetType();
            isSpatialBehaviour = HasWorkerTypeAttribute(scriptType) ||
                                 RequiredSubscriptionsDatabase.HasRequiredSubscriptions(scriptType);
            if (!isSpatialBehaviour)
            {
                return;
            }

            linkedEntityComponent = script.GetComponent <LinkedEntityComponent>();
            var requiredWorkerTypes = GetRequiredWorkerTypes(scriptType);

            subscriptions = new Dictionary <FieldInfo, ISubscription>();
            var subscriptionsInfo = RequiredSubscriptionsDatabase.GetOrCreateRequiredSubscriptionsInfo(scriptType);

            // Get subscription info when playing
            if (Application.isPlaying && linkedEntityComponent != null)
            {
                workerType   = linkedEntityComponent.Worker.WorkerType;
                isWorkerType = requiredWorkerTypes?.Contains(workerType);
                if (isWorkerType.HasValue)
                {
                    requiredWorkerTypesLabel = string.Join(" || ", requiredWorkerTypes);
                }

                var subscriptionSystem = linkedEntityComponent.World.GetExistingSystem <SubscriptionSystem>();

                subscriptionsInfo?.RequiredFields?.ForEach(fieldInfo =>
                {
                    var subscription =
                        subscriptionSystem.Subscribe(linkedEntityComponent.EntityId, fieldInfo.FieldType);
                    subscriptions.Add(fieldInfo, subscription);
                });
            }
            else
            {
                if (requiredWorkerTypes != null)
                {
                    requiredWorkerTypesLabel = string.Join(" || ", requiredWorkerTypes);
                }

                subscriptionsInfo?.RequiredFields?.ForEach(fieldInfo =>
                {
                    subscriptions.Add(fieldInfo, null);
                });
            }
        }
예제 #9
0
        private void OnEnable()
        {
            LinkedEntityComponent = GetComponent <LinkedEntityComponent>();
            origin = LinkedEntityComponent.Worker.Origin;

            server.OnLatestUpdate += OnServerUpdate;
            client.OnLatestUpdate += OnClientUpdate;

            OnClientUpdate(client.Data.Latest);
            OnServerUpdate(server.Data.Latest);
        }
예제 #10
0
        void OnEnable()
        {
            _spatialOsComponent = GetComponent <LinkedEntityComponent>();

            // Initialize entity's gameobject transform from Position and Rotation component values
            transform.position = PositionReader.Data.Coords.ToUnityVector() + _spatialOsComponent.Worker.Origin;

            // Register callback for when component changes
            PositionReader.OnUpdate += (OnPositionUpdated);

            OnRun();
        }
예제 #11
0
        private void OnEnable()
        {
            _linkedEntity = GetComponent <LinkedEntityComponent>();

            _commandReceiver.OnAddCommandRequestReceived += OnAddCommandRequest;

            var worldPosition = _positionWriter.Data.Coords.ToUnityVector();

            _position         = new Vector2(worldPosition.x, worldPosition.z);
            _activeCommand    = _droneWriter.Data.ActiveCommand;
            _commandQueue     = new List <Command>(_droneWriter.Data.CommandQueue);
            _timeToNextUpdate = UPDATE_INTERVAL;
        }
예제 #12
0
        private void OnEnable()
        {
            _display      = GetComponentInChildren <MeshRenderer>();
            _linkedEntity = GetComponent <LinkedEntityComponent>();
            _player       = FindObjectOfType <AuthoritativePlayer>();

            _player.SelectedDroneChanged += OnSelectedDroneChanged;

            // Setup initial material.
            _defaultMaterial = _display.sharedMaterial;
            if (IsOwned)
            {
                _display.sharedMaterial = _playerMaterial;
            }
        }
예제 #13
0
        public LinkedEntityComponent getShotEnityID(float range, Ray ray)
        {
            var hitLocation  = ray.origin + ray.direction * range;
            var hitSomething = false;
            LinkedEntityComponent linkeentity = null;

            if (Physics.Raycast(ray, out var hit, range, shootingLayerMask))
            {
                hitSomething = true;
                hitLocation  = hit.point;
                var spatialEntity = hit.transform.root.GetComponent <LinkedEntityComponent>();
                //var cc = hit.transform.root.GetComponent<HealthPickupClientVisibility>();
                if ((spatialEntity != null))// && (cc != null))
                {
                    linkeentity = spatialEntity;
                }
            }

            return(linkeentity);
        }
예제 #14
0
 private void OnEnable()
 {
     spatial = GetComponent <LinkedEntityComponent>();
 }
예제 #15
0
 private void OnEnable()
 {
     respawnRequests.OnRequestRespawnRequestReceived += OnRequestRespawn;
     spatial = GetComponent <LinkedEntityComponent>();
 }
예제 #16
0
 private void OnEnable()
 {
     shooting.OnShotsEvent += ShotFired;
     spatial = GetComponent <LinkedEntityComponent>();
 }
예제 #17
0
 void Start()
 {
     maxRange            = CalculateMaxRange();
     firerColliders      = gameObject.GetComponentsInChildren <Collider>();
     _spatialOsComponent = GetComponent <LinkedEntityComponent>();
 }
 private void OnEnable()
 {
     linkedEntityComponent = gameObject.GetComponent <LinkedEntityComponent>();
     fireCannon            = true;
     cheatModeText.SetActive(false);
 }
 private void OnEnable()
 {
     link             = GetComponent <LinkedEntityComponent>();
     reader.OnUpdate += OnPlayerResComponentUpdated;
     inGameManager.txtResValue.text = "" + reader.Data.ResValue + " 吃血包 C造兵 F移动 G攻击";
 }
 private void OnEnable()
 {
     link = GetComponent <LinkedEntityComponent>();
 }