예제 #1
0
        private void OnStartup(EntityUid uid, DeployableBarrierComponent component, ComponentStartup args)
        {
            if (!EntityManager.TryGetComponent(component.Owner, out LockComponent? lockComponent))
            {
                return;
            }

            ToggleBarrierDeploy(component, lockComponent.Locked);
        }
        private void ToggleBarrierDeploy(DeployableBarrierComponent component, bool isDeployed)
        {
            component.Owner.Transform.Anchored = isDeployed;

            if (!component.Owner.TryGetComponent(out AppearanceComponent? appearanceComponent))
            {
                return;
            }

            var state = isDeployed ? DeployableBarrierState.Deployed : DeployableBarrierState.Idle;

            appearanceComponent.SetData(DeployableBarrierVisuals.State, state);
        }
예제 #3
0
        private void ToggleBarrierDeploy(DeployableBarrierComponent component, bool isDeployed)
        {
            EntityManager.GetComponent <TransformComponent>(component.Owner).Anchored = isDeployed;

            if (!EntityManager.TryGetComponent(component.Owner, out AppearanceComponent? appearanceComponent))
            {
                return;
            }

            var state = isDeployed ? DeployableBarrierState.Deployed : DeployableBarrierState.Idle;

            appearanceComponent.SetData(DeployableBarrierVisuals.State, state);

            if (EntityManager.TryGetComponent(component.Owner, out PointLightComponent? light))
            {
                light.Enabled = isDeployed;
            }
        }
예제 #4
0
 private void OnLockToggled(EntityUid uid, DeployableBarrierComponent component, LockToggledEvent args)
 {
     ToggleBarrierDeploy(component, args.Locked);
 }