Exemple #1
0
        //public override void OnDraw(Renderer renderer)
        //{
        //    base.OnDraw(renderer);

        //    if (renderer.Stage == RenderStage.PostBloom && Flying)
        //    {
        //        var Col = new Color(Color.White, 0.25f);

        //        renderer.PrimitivesRenderer.DrawTriangle(new Vector2(0, 375 - 40), new Vector2(1103 + 40, 375), new Vector2(999, 227), Col);
        //        renderer.PrimitivesRenderer.DrawTriangle(new Vector2(0, 375 - 40), new Vector2(999, 227), new Vector2(104, 227), Col);

        //        Col = new Color(Color.Blue, 0.25f);

        //        renderer.PrimitivesRenderer.DrawTriangle(new Vector2(110, 45), new Vector2(985, 45), new Vector2(1072, 10), Col);
        //        renderer.PrimitivesRenderer.DrawTriangle(new Vector2(110, 45), new Vector2(1072, 10), new Vector2(14, 10), Col);

        //        Col = Color.Red;

        //        renderer.PrimitivesRenderer.DrawRectangle(Transform.Position - new Vector2(1, 1), Transform.Position + new Vector2(1, 1), Col);

        //        Col = Color.Blue;

        //        renderer.PrimitivesRenderer.DrawRectangle(DisplacedPosition - new Vector2(1, 1), DisplacedPosition + new Vector2(1, 1), Col);

        //        RestrictionPathCeiling.Draw(renderer.PrimitivesRenderer.DrawTriangle, renderer.PrimitivesRenderer.DrawLine, World.Get<Mouse>().Position);

        //        Col = new Color(Color.Bisque, 0.25f);

        //        renderer.PrimitivesRenderer.DrawRectangle(Tree.Basement.RFIDAntennaCabinet.Collider, Col);
        //    }
        //}

        /// <summary>
        /// Places the drone on the initial floor position, sets its scale and makes it visible & enabled.
        /// </summary>
        public void PlaceOnFloor()
        {
            Transform.SetPosition(INITIAL_POSITION);
            var CeilingPosition = GetCeilingPosition(INITIAL_POSITION);
            var Scale           = RestrictionPathCeiling.GetScale(CeilingPosition.Y);

            Transform.SetScale(Scale);
            Get <Interaction>().SetPosition(INITIAL_POSITION);
            Transform.SetZ(INITIAL_Z);
            Orientation = Directions4.Down;
            Visible     = true;
            Enabled     = true;
        }
Exemple #2
0
        public override void OnUpdate()
        {
            base.OnUpdate();

            if (Flying && null == FlyingSoundEffect)
            {
                PlayFlyingSound();
            }

            if (Flying && ReachedCeiling)
            {
                UnitPosition = ProjectionCeiling.TransformInverse(Transform.Position);

                var DisplacedUnitPosition = UnitPosition + Get <DroneDisplacement>().GetDisplacement() / new Vector2(500f, 80f);
                DisplacedPosition = ProjectionCeiling.Transform(DisplacedUnitPosition);

                var Scale = RestrictionPathCeiling.GetScale(Transform.Position.Y);
                Transform.SetScale(Scale);

                var DroneCollided = !RestrictionPathCeiling.Contains(DisplacedPosition);

                if (Tree.Basement.RFIDAntennaCabinet.Enabled && Tree.Basement.RFIDAntennaCabinet.Collider.Contains(DisplacedPosition) && !Tree.Basement.RFIDAntennaCabinet.FellDown)
                {
                    DroneCollided = true;
                    Tree.Basement.RFIDAntennaCabinet.StartFallDownScript();
                }

                if (DroneCollided)
                {
                    StopFlyingSound();
                    Game.PlaySoundEffect(content.audio.drone_shutdown);
                    Crashed = true;
                    Get <Scripts>().Clear();
                    Get <Scripts>().Start(LandScript());

                    // Decrease displacement amplitude = difficulty
                    Get <DroneDisplacement>().SetAmplitude(Get <DroneDisplacement>().Amplitude - 2);

                    if (Tree.GUI.Dialog.Menu.State == GUI.Dialog.DialogMenuState.Open ||
                        Tree.GUI.Dialog.Menu.State == GUI.Dialog.DialogMenuState.Opening)
                    {
                        Tree.GUI.Dialog.Menu.Close();
                    }
                }
            }
            else
            {
                DisplacedPosition = Transform.Position;
            }
        }