Example #1
0
        protected override void Initialize()
        {
            base.Initialize();

            this.CurrentEpisode = 0;

            if (WaveServices.Platform.IsEditor ||
                (string.IsNullOrEmpty(this.ShipEntityPath)) ||
                (string.IsNullOrEmpty(this.TerrainEntityPath)))
            {
                return;
            }

            this.randy = WaveServices.Random;

            this.shipComponent = this.Owner.Find(this.ShipEntityPath)?.FindComponent <ShipComponent>();
            this.terrain       = this.Owner.Find(this.TerrainEntityPath)?.FindComponent <TerrainMeshComponent>();

            this.networkService = WaveServices.GetService <Lunar3DNetworkService>();

            if (this.networkService != null)
            {
                this.networkService.ActionReveiced += this.OnActionReceived;
                this.networkService.OnReset        += this.OnReset;
                this.networkService.Updated        += this.OnUpdated;
                this.networkService.Rendered       += this.OnRendered;

                this.Owner.Scene.Pause();
                this.Owner.Scene.IsVisible = false;
            }
            else
            {
                this.Reset();
            }
        }
Example #2
0
 internal void RefreshObservations(Lunar3DNetworkService networkService)
 {
     networkService.LanderPosition        = this.transform.Position / PositionNormFactor;
     networkService.LanderVelocity        = this.shipBody.LinearVelocity / VelocityNormFactor;
     networkService.LanderAngle           = this.transform.Rotation / AnguleNormFactor;
     networkService.LanderAngularVelocity = this.shipBody.AngularVelocity / AngularVelocityNormFactor;
     networkService.LanderBodyCollided    = this.bodyCollision;
     networkService.LanderFootGroundedF   = this.footFCollision;
     networkService.LanderFootGroundedB   = this.footBCollision;
     networkService.LanderFootGroundedL   = this.footLCollision;
     networkService.LanderFootGroundedR   = this.footRCollision;
     networkService.LanderAwake           = this.shipBody.InternalBody.IsActive;
 }