Exemple #1
0
        public static StaticRangeTarget CreateNew(EntityInstancePlugin plugin, ILevelManager level, Vector3 position)
        {
            var newInstance = new StaticRangeTarget(level, position);

            ((LevelManager)level).RegisterRangeTarget(newInstance);
            plugin.Entity.AddComponent(newInstance);

            return(newInstance);
        }
Exemple #2
0
            public static StDefaultComponent SaveState(StaticRangeTarget staticRangeTarget)
            {
                var storedStaticRangeTarget = new StStaticRangeTarget
                {
                    Enabled    = staticRangeTarget.Enabled,
                    InstanceID = staticRangeTarget.InstanceID,
                    Position   = staticRangeTarget.CurrentPosition.ToStVector3()
                };

                return(new StDefaultComponent {
                    StaticRangeTarget = storedStaticRangeTarget
                });
            }
Exemple #3
0
            public override void StartLoading()
            {
                if (storedData.ComponentCase != StDefaultComponent.ComponentOneofCase.StaticRangeTarget)
                {
                    throw new ArgumentException("Invalid component type data passed to loader", nameof(storedData));
                }

                var storedStaticRangeTarget = storedData.StaticRangeTarget;

                StaticRangeTarget = new StaticRangeTarget(storedStaticRangeTarget.InstanceID,
                                                          level,
                                                          storedStaticRangeTarget.Position.ToVector3())
                {
                    Enabled = storedStaticRangeTarget.Enabled
                };
                level.LoadRangeTarget(StaticRangeTarget);
            }