Esempio n. 1
0
    private void Start()
    {
        agent = GetComponent <NavMeshAgent>();
        state = TruckState.SELECTING;

        gateToOpen.onOpen += OnGateOpen;
    }
        void Reset_Angel()
        {
            angelState = TruckState.Default;

            if (rightOfWay == RightOfWay.Angel)
            {
                rightOfWay = RightOfWay.Default;
            }

            //truckAngelCollisionBox.Position = camera._currentPosition + new Vector2(16.7f, -1.0f);
            if (truckDemonCollisionBox.Position.X + 9 < wallRight_1.Position.X)
            {
                truckAngelCollisionBox.Position = truckDemonCollisionBox.Position + new Vector2(13f, -1f);

                _wheelBackAngel.Position  = truckAngelCollisionBox.Position + new Vector2(0f, 0.55f);
                _wheelFrontAngel.Position = truckAngelCollisionBox.Position + new Vector2(1.1f, 0.55f);

                truckAngelCollisionBox.Rotation        = 0.0f;
                truckAngelCollisionBox.LinearVelocity  = new Vector2(0, 0);
                truckAngelCollisionBox.AngularVelocity = 0f;

                truckDemonCollisionBox.ApplyLinearImpulse(new Vector2(-15f, 0));
            }

            angelFlipped         = false;
            angelCrash           = false;
            angelSpawned         = true;
            _remainingDelayAngel = _respawnDelayAngel;
            //cameraTarget = CameraTarget.Demon;
        }
        void Reset_Demon()
        {
            demonState = TruckState.Default;

            if (rightOfWay == RightOfWay.Demon)
            {
                rightOfWay = RightOfWay.Default;
            }

            //truckDemonCollisionBox.Position = camera._currentPosition + new Vector2(3.5f, -1.0f);
            {
                truckDemonCollisionBox.Position        = truckAngelCollisionBox.Position + new Vector2(-13f, -1f);
                truckDemonCollisionBox.Rotation        = 0.0f;
                truckDemonCollisionBox.LinearVelocity  = new Vector2(0, 0);
                truckDemonCollisionBox.AngularVelocity = 0f;

                _wheelBackDemon.Position  = truckDemonCollisionBox.Position + new Vector2(-1.1f, 0.6f);
                _wheelFrontDemon.Position = truckDemonCollisionBox.Position + new Vector2(-0.1f, 0.6f);

                truckAngelCollisionBox.ApplyLinearImpulse(new Vector2(15f, 0));
            }

            demonFlipped         = false;
            demonCrash           = false;
            demonSpawned         = true;
            _remainingDelayDemon = _respawnDelayDemon;
            //cameraTarget = CameraTarget.Angel;
        }
Esempio n. 4
0
    // Update is called once per frame
    void Update()
    {
        switch (State)
        {
        case TruckState.LOADING_BAY:
        {
            if (CheckGoods())
            {
                State = TruckState.TRANSIT_AWAY;
                Timer = 0.0f;
            }
        }
        break;

        case TruckState.TRANSIT_AWAY:
        {
            Timer += GameLogic.Instance.DeltaTime();

            Truck.transform.position += new Vector3(TruckDistance / TransitTime * GameLogic.Instance.DeltaTime(), 0.0f, 0.0f);
            if (Timer >= TransitTime)
            {
                Truck.transform.position = TruckPos.position + new Vector3(TruckDistance, 0.0f, 0.0f);
                State = TruckState.AWAY;
                Timer = 0.0f;
            }
        }
        break;

        case TruckState.AWAY:
        {
            Timer += GameLogic.Instance.DeltaTime();

            if (Timer >= GameLogic.Instance.TruckWaitTime)
            {
                State = TruckState.TRANSIT_LOADING_BAY;
                Timer = 0.0f;
            }
        }
        break;

        case TruckState.TRANSIT_LOADING_BAY:
        {
            Timer += GameLogic.Instance.DeltaTime();
            Truck.transform.position -= new Vector3(TruckDistance / TransitTime * GameLogic.Instance.DeltaTime(), 0.0f, 0.0f);
            if (Timer >= TransitTime)
            {
                //Generate goals
                GenerateRequiredGoods();
                Truck.transform.position = TruckPos.position;
                State = TruckState.LOADING_BAY;
                Timer = 0.0f;
            }
        }
        break;

        default:
            break;
        }
    }
 public void Arrive()
 {
     Init();
     _currState = TruckState.Arriving;
     _slotAnimator.SetTrigger("Park");
     GetComponent <AudioSource>().Play();
     TruckSlider.gameObject.SetActive(false);
 }
 void StateArriving()
 {
     if (AnimationFinished)
     {
         _currState = TruckState.Waiting;
         GetComponent <AudioSource>().Stop();
         TruckSlider.gameObject.SetActive(true);
     }
 }
Esempio n. 7
0
/*
 *      public void PrepareRouteStop(RouteStop result, RouteStop previousStop, EquipmentConfiguration equipment)
 *      {
 *
 *          if (result.StopAction == StopActions.LiveLoading || result.StopAction == StopActions.LiveUnloading)
 *          {
 *              if (previousStop == null)
 *              {
 *                  throw new Exception("Live action cannot be the first stop of an order");
 *              }
 *
 *              result.PreTruckConfig = new TruckConfiguration()
 *              {
 *                  EquipmentConfiguration = new EquipmentConfiguration()
 *                  {
 *                      Chassis = previousStop.PostTruckConfig.EquipmentConfiguration.Chassis,
 *                      ChassisOwner = previousStop.PostTruckConfig.EquipmentConfiguration.ChassisOwner,
 *                      Container = previousStop.PostTruckConfig.EquipmentConfiguration.Container,
 *                      ContainerOwner = previousStop.PostTruckConfig.EquipmentConfiguration.ContainerOwner,
 *                  },
 *                  IsLoaded = previousStop.PostTruckConfig.IsLoaded
 *              };
 *
 *              result.PostTruckConfig = new TruckConfiguration()
 *              {
 *                  EquipmentConfiguration = new EquipmentConfiguration()
 *                  {
 *                      Chassis = previousStop.PostTruckConfig.EquipmentConfiguration.Chassis,
 *                      ChassisOwner = previousStop.PostTruckConfig.EquipmentConfiguration.ChassisOwner,
 *                      Container = previousStop.PostTruckConfig.EquipmentConfiguration.Container,
 *                      ContainerOwner = previousStop.PostTruckConfig.EquipmentConfiguration.ContainerOwner,
 *                  },
 *                  IsLoaded = previousStop.PostTruckConfig.IsLoaded
 *              };
 *
 *              if (result.StopAction == StopActions.LiveLoading)
 *              {
 *                  result.PostTruckConfig.IsLoaded = true;
 *              }
 *
 *              if (result.StopAction == StopActions.LiveUnloading)
 *              {
 *                  result.PostTruckConfig.IsLoaded = false;
 *
 *                  // mark previous live unloading stop as loaded
 *                  if (previousStop.StopAction == StopActions.LiveUnloading)
 *                  {
 *                      previousStop.PostTruckConfig.IsLoaded = true;
 *                      result.PreTruckConfig.IsLoaded = true;
 *                  }
 *              }
 *
 *          }
 *
 *          else
 *          {
 *              result.PreTruckConfig = GetTruckConfigForAction(result.StopAction.PreState, equipment);
 *              result.PostTruckConfig = GetTruckConfigForAction(result.StopAction.PostState, equipment);
 *          }
 *
 *          if (!IsValidRouteStop(result))
 *          {
 *              Console.WriteLine(string.Format("\t\t{0} is apparently not valid for some reason.", result.Location.DisplayName));
 * //                throw new Exception("Invalid Route Stop");
 *          }
 *      }
 */
        public TruckConfiguration GetTruckConfigForAction(TruckState truckState, EquipmentConfiguration equipment)
        {
            TruckConfiguration truckConfiguration = null;

            switch (truckState)
            {
            case TruckState.Chassis:
                truckConfiguration = new TruckConfiguration()
                {
                    EquipmentConfiguration = new EquipmentConfiguration()
                    {
                        Chassis      = equipment.Chassis,
                        ChassisOwner = equipment.ChassisOwner,
                    }
                };

                break;

            case TruckState.Empty:

                truckConfiguration = new TruckConfiguration()
                {
                    EquipmentConfiguration = new EquipmentConfiguration()
                    {
                        Chassis        = equipment.Chassis,
                        ChassisOwner   = equipment.ChassisOwner,
                        Container      = equipment.Container,
                        ContainerOwner = equipment.ContainerOwner,
                    }
                };


                break;

            case TruckState.Loaded:

                truckConfiguration = new TruckConfiguration()
                {
                    IsLoaded = true,
                    EquipmentConfiguration = new EquipmentConfiguration()
                    {
                        Chassis        = equipment.Chassis,
                        ChassisOwner   = equipment.ChassisOwner,
                        Container      = equipment.Container,
                        ContainerOwner = equipment.ContainerOwner,
                    }
                };

                break;

            default:
                truckConfiguration = new TruckConfiguration();
                break;
            }

            return(truckConfiguration);
        }
    void StateLeaving()
    {
        if (AnimationFinished)
        {
            _currState = TruckState.OffScreen;
            ProcessPayment();
            GameManager.Instance.TruckIsOffscreen(_isDeliveryTruck);

            for (int i = 0; i < _truckInventory.Count; i++)
            {
                _truckInventory[i].transform.SetParent(null);
                Destroy(_truckInventory[i].gameObject);
            }
            _truckInventory.Clear();
        }
    }
Esempio n. 9
0
 private void Update()
 {
     if (gameManager.boxLoaded < 6)
     {
         truckState = TruckState.WAITING;
     }
     else if ((6 <= gameManager.boxLoaded && gameManager.boxLoaded < 8) && truckState == TruckState.WAITING)
     {
         truckState = TruckState.ALMOST_LOAD;
         smokeManager.StartCoroutine("SmokeLoop");
     }
     else if ((gameManager.boxLoaded == 8) && truckState == TruckState.ALMOST_LOAD)
     {
         truckState = TruckState.READY_TO_GO;
     }
 }
    public void Leave()
    {
        _currState = TruckState.Leaving;

        TruckSlider.gameObject.SetActive(false);

        for (int i = 0; i < _itemAnchors.Length; i++)
        {
            var draggable = _itemAnchors[i].GetComponentInChildren <Draggable>();
            if (draggable != null)
            {
                draggable.CanDrag = false;
            }
        }

        _slotAnimator.SetTrigger("Leave");
    }
        void CameraMove(Fixture a, Fixture b)
        {
            if (rightOfWay == RightOfWay.Angel && b.Body == truckDemonCollisionBox && a.Body == wallRight)
            {
                //LockCamera();
                //Reset_Demon();
                //rightOfWay = RightOfWay.Default;
                demonState = TruckState.Spawned;
            }

            if (rightOfWay == RightOfWay.Demon && b.Body == truckAngelCollisionBox && a.Body == wallLeft)
            {
                //LockCamera();
                //Reset_Angel();
                //rightOfWay = RightOfWay.Default;
                angelState = TruckState.Spawned;
            }
        }
Esempio n. 12
0
 private void CheckDistance()
 {
     if (Vector3.Distance(transform.position, positions[currentPositionIndex].position) <= 10f)
     {
         if (currentPositionIndex == 5)
         {
             state = TruckState.WAITING;
         }
         else
         {
             if (currentPositionIndex != positions.Length - 1)
             {
                 SelectNewPosition();
             }
             else
             {
                 state = TruckState.WAITING;
             }
         }
     }
 }
        bool Sacrifice_Possesion(Fixture a, Fixture b, Contact contact)
        {
            if (b.Body == truckDemonCollisionBox && sacrificeState == SacrificeState.Unpossessed)
            {
                rightOfWay     = RightOfWay.Demon;
                demonState     = TruckState.HasRightOfWay;
                sacrificeState = SacrificeState.Possessed;
                truckDemonCollisionBox.UserData = "demon_sacrifice";

                audioManager.PlaySound("sacrifice_pickup");
            }

            else if (b.Body == truckAngelCollisionBox && sacrificeState == SacrificeState.Unpossessed)
            {
                rightOfWay     = RightOfWay.Angel;
                angelState     = TruckState.HasRightOfWay;
                sacrificeState = SacrificeState.Possessed;
                truckAngelCollisionBox.UserData = "angel_sacrifice";

                audioManager.PlaySound("sacrifice_pickup");
            }
            return(true);
        }
Esempio n. 14
0
 private void MoveTo(Vector3 position)
 {
     agent.SetDestination(position);
     state = TruckState.MOVING;
 }
        public override void Update(GameTime gameTime)
        {
            //MediaPlayer.Play(song);

            if (!angelVictoryGoal.activated && !demonVictoryGoal.activated)
            {
                world.Step(Math.Min((float)gameTime.ElapsedGameTime.TotalMilliseconds * 0.001f, (1f / 30f)));
            }

            if (InputManager.Instance.KeyPressed(Keys.Escape))
            {
                ScreenManager.Instance.ChangeScreens("TitleScreen");
            }
            else if (InputManager.Instance.KeyPressed(Keys.Enter) && (angelVictoryGoal.activated || demonVictoryGoal.activated))
            {
                ScreenManager.Instance.ChangeScreens("GameplayScreen");
            }

            _wheelBackAngel.OnCollision   += new OnCollisionEventHandler(Rear_OnCollisionAngel);
            _wheelFrontAngel.OnCollision  += new OnCollisionEventHandler(Front_OnCollisionAngel);
            _wheelBackAngel.OnSeparation  += new OnSeparationEventHandler(Rear_OnSeperationAngel);
            _wheelFrontAngel.OnSeparation += new OnSeparationEventHandler(Front_OnSeperationAngel);

            truckAngelCollisionBox.OnCollision  += new OnCollisionEventHandler(FlipCheck_Angel);
            truckAngelCollisionBox.OnSeparation += new OnSeparationEventHandler(StillFlipped_Angel);

            sacrifice.OnCollision += new OnCollisionEventHandler(Sacrifice_Possesion);

            //wallLeft.IgnoreCollisionWith(_wheelBackAngel);
            //wallRight.IgnoreCollisionWith(_wheelFrontDemon);
            wallLeft.OnSeparation  += new OnSeparationEventHandler(CameraMove);
            wallRight.OnSeparation += new OnSeparationEventHandler(CameraMove);

            _springBackAngel.MotorSpeed  = Math.Sign(_accelerationAngel) * MathHelper.SmoothStep(0f, MaxSpeed, Math.Abs(_accelerationAngel));
            _springFrontAngel.MotorSpeed = Math.Sign(_accelerationAngel) * MathHelper.SmoothStep(0f, MaxSpeed, Math.Abs(_accelerationAngel));
            if (Math.Abs(_springBackAngel.MotorSpeed) < MaxSpeed * 0.06f || (Math.Abs(_springFrontAngel.MotorSpeed) < MaxSpeed * 0.06f))
            {
                _springBackAngel.MotorEnabled  = false;
                _springFrontAngel.MotorEnabled = false;
            }
            else
            {
                _springBackAngel.MotorEnabled  = true;
                _springFrontAngel.MotorEnabled = true;
            }

            // Move our sprite based on arrow keys being pressed:
            if (InputManager.Instance.KeyDown(Keys.Right))
            {
                if (frontInTheAirAngel && rearInTheAirAngel)
                {
                    truckAngelCollisionBox.ApplyAngularImpulse(0.3f);
                }
                else
                {
                    _accelerationAngel             = Math.Min(_accelerationAngel + (float)(5.0 * gameTime.ElapsedGameTime.TotalSeconds), 1f);
                    _springFrontAngel.MotorEnabled = false;
                    _springBackAngel.MotorEnabled  = true;
                }
            }
            else if (InputManager.Instance.KeyDown(Keys.Left))
            {
                if (frontInTheAirAngel && rearInTheAirAngel && !angelSpawned)
                {
                    truckAngelCollisionBox.ApplyAngularImpulse(-0.3f);
                }
                else
                {
                    _accelerationAngel             = Math.Max(_accelerationAngel - (float)(5.0 * gameTime.ElapsedGameTime.TotalSeconds), -1f);
                    _springBackAngel.MotorEnabled  = false;
                    _springFrontAngel.MotorEnabled = true;
                }
            }
            else if (InputManager.Instance.KeyDown(Keys.Down))
            {
                truckAngelCollisionBox.ApplyAngularImpulse(-0.9f);
            }
            else
            {
                _accelerationAngel = 0f;
            }

            if (InputManager.Instance.KeyPressed(Keys.Up))
            {
                if (!rearInTheAirAngel || !frontInTheAirAngel)
                {
                    truckAngelCollisionBox.ApplyForce(new Vector2(0, -1500), truckAngelCollisionBox.Position + new Vector2(0.3f, 0f));
                }
            }

            else if (InputManager.Instance.KeyPressed(Keys.RightShift))
            {
                //audioManager.PlaySound("sacrifice_pickup");

                if (!rearInTheAirAngel)
                {
                    angelFlick = true;
                    truckAngelCollisionBox.AngularDamping  = 40f;
                    truckAngelCollisionBox.AngularVelocity = 110f;
                }
            }

            if (angelFlick)
            {
                var timer = (float)gameTime.ElapsedGameTime.TotalMilliseconds;

                _angelFlipTimer -= timer;

                //Console.WriteLine(_angelFlipTimer);

                if (_angelFlipTimer <= 0)
                {
                    truckAngelCollisionBox.AngularDamping  = 0f;
                    truckAngelCollisionBox.AngularVelocity = 0f;
                    _angelFlipTimer = _flipTimeAngel;
                    angelFlick      = false;
                }
            }

            if (angelCrash)
            {
                var timer = (float)gameTime.ElapsedGameTime.TotalSeconds;

                _remainingDelayAngel -= timer;

                if (_remainingDelayAngel <= 0.5f && angelFlipped)

                {
                    angelState = TruckState.Dead;
                    audioManager.PlaySound("crash1");

                    if (sacrificeState == SacrificeState.Possessed && rightOfWay == RightOfWay.Angel)
                    {
                        sacrificeState = SacrificeState.Dropped;
                        truckAngelCollisionBox.UserData = "angel";
                    }

                    if (_remainingDelayAngel <= 0 && angelFlipped)
                    {
                        Reset_Angel();
                    }
                }
            }

            _wheelBackDemon.OnCollision   += new OnCollisionEventHandler(Rear_OnCollisionDemon);
            _wheelFrontDemon.OnCollision  += new OnCollisionEventHandler(Front_OnCollisionDemon);
            _wheelBackDemon.OnSeparation  += new OnSeparationEventHandler(Rear_OnSeperationDemon);
            _wheelFrontDemon.OnSeparation += new OnSeparationEventHandler(Front_OnSeperationDemon);

            truckDemonCollisionBox.OnCollision  += new OnCollisionEventHandler(FlipCheck_Demon);
            truckDemonCollisionBox.OnSeparation += new OnSeparationEventHandler(StillFlipped_Demon);

            _springBackDemon.MotorSpeed  = Math.Sign(_accelerationDemon) * MathHelper.SmoothStep(0f, MaxSpeed, Math.Abs(_accelerationDemon));
            _springFrontDemon.MotorSpeed = Math.Sign(_accelerationDemon) * MathHelper.SmoothStep(0f, MaxSpeed, Math.Abs(_accelerationDemon));

            if (Math.Abs(_springBackDemon.MotorSpeed) < MaxSpeed * 0.06f || (Math.Abs(_springFrontDemon.MotorSpeed) < MaxSpeed * 0.06f))
            {
                _springBackDemon.MotorEnabled  = false;
                _springFrontDemon.MotorEnabled = false;
            }
            else
            {
                _springBackDemon.MotorEnabled  = true;
                _springFrontDemon.MotorEnabled = true;
            }

            // Move our sprite based on arrow keys being pressed:
            if (InputManager.Instance.KeyDown(Keys.D))
            {
                if (frontInTheAirDemon && rearInTheAirDemon && !demonSpawned)
                {
                    truckDemonCollisionBox.ApplyAngularImpulse(0.3f);
                }
                else
                {
                    _accelerationDemon             = Math.Min(_accelerationDemon + (float)(5.0 * gameTime.ElapsedGameTime.TotalSeconds), 1f);
                    _springFrontDemon.MotorEnabled = false;
                    _springBackDemon.MotorEnabled  = true;
                }
            }
            else if (InputManager.Instance.KeyDown(Keys.A))
            {
                if (frontInTheAirDemon && rearInTheAirDemon)
                {
                    truckDemonCollisionBox.ApplyAngularImpulse(-0.3f);
                }
                else
                {
                    _accelerationDemon             = Math.Max(_accelerationDemon - (float)(5.0 * gameTime.ElapsedGameTime.TotalSeconds), -1f);
                    _springBackDemon.MotorEnabled  = false;
                    _springFrontDemon.MotorEnabled = true;
                }
            }
            else if (InputManager.Instance.KeyDown(Keys.S))
            {
                truckDemonCollisionBox.ApplyAngularImpulse(0.9f);
            }
            else
            {
                _accelerationDemon = 0f;
            }

            if (InputManager.Instance.KeyPressed(Keys.LeftShift))
            {
                if (!frontInTheAirDemon)
                {
                    demonFlick = true;
                    truckDemonCollisionBox.AngularDamping  = 40f;
                    truckDemonCollisionBox.AngularVelocity = -120f;
                }
            }

            else if (InputManager.Instance.KeyPressed(Keys.W))
            {
                if (!rearInTheAirDemon || !frontInTheAirDemon)
                {
                    truckDemonCollisionBox.ApplyForce(new Vector2(0, -1500), truckDemonCollisionBox.Position + new Vector2(-0.35f, 0f));
                }
            }

            if (demonFlick)
            {
                var timer = (float)gameTime.ElapsedGameTime.TotalMilliseconds;

                _demonFlipTimer -= timer;

                if (_demonFlipTimer <= 0)
                {
                    truckDemonCollisionBox.AngularDamping  = 0;
                    truckDemonCollisionBox.AngularVelocity = 0;
                    _demonFlipTimer = _flipTimeDemon;
                    demonFlick      = false;
                }
            }

            if (demonCrash)
            {
                //Console.WriteLine("\nDEBUG1");

                var timer = (float)gameTime.ElapsedGameTime.TotalSeconds;

                _remainingDelayDemon -= timer;

                if (_remainingDelayDemon <= 0.5 && demonFlipped)
                {
                    demonState = TruckState.Dead;
                    audioManager.PlaySound("crash1");

                    if (sacrificeState == SacrificeState.Possessed && rightOfWay == RightOfWay.Demon)
                    {
                        sacrificeState = SacrificeState.Dropped;
                        truckAngelCollisionBox.UserData = "demon";
                    }

                    if (_remainingDelayDemon <= 0 && demonFlipped)
                    {
                        Reset_Demon();
                    }
                }
            }


            if (cameraTarget == CameraTarget.Angel)
            {
                camera.TrackingBody           = truckAngelCollisionBox;
                camera.EnablePositionTracking = true;
                camera._translateCenter       = new Vector2(17f, 0.0f);
            }
            else if (cameraTarget == CameraTarget.Demon)
            {
                camera.TrackingBody           = truckDemonCollisionBox;
                camera.EnablePositionTracking = true;
                camera._translateCenter       = new Vector2(3f, 0.0f);
            }
            else if (cameraTarget == CameraTarget.Lock)
            {
                camera.EnablePositionTracking = false;
                camera.MoveCamera(camera._translateCenter * new Vector2(-1, -1));
                camera._translateCenter = new Vector2(0, 0);

                wallLeft.Position  = camera._currentPosition + new Vector2(0, 5);
                wallRight.Position = camera._currentPosition + new Vector2(19.2f, 5);
            }
            else if (cameraTarget == CameraTarget.Init)
            {
                camera.EnablePositionTracking = false;
                camera._translateCenter       = new Vector2(0f, 0.0f);
            }

            background.Update(gameTime);
            truckAngel.Update(gameTime);
            tireAngel.Update(gameTime);
            instructionAngel.Update(gameTime);
            instructionDemon.Update(gameTime);
            endText.Update(gameTime);
            truckDemon.Update(gameTime);
            tireDemon.Update(gameTime);

            sacrificeSprite.Update(gameTime);

            switch (sacrificeState)
            {
            case SacrificeState.Dropped:
                if (rightOfWay == RightOfWay.Angel)
                {
                    sacrifice.Position = truckAngelCollisionBox.Position + new Vector2(0, -1.5f);
                    //sacrifice.LinearVelocity = new Vector2(0, 0);
                    sacrifice.ApplyLinearImpulse(new Vector2(-2, -2f));
                    sacrificeState = SacrificeState.Unpossessed;
                    rightOfWay     = RightOfWay.Default;
                }

                else if (rightOfWay == RightOfWay.Demon)
                {
                    sacrifice.Position = truckDemonCollisionBox.Position + new Vector2(0, -1.5f);
                    //sacrifice.LinearVelocity = new Vector2(0, 0);
                    sacrifice.ApplyLinearImpulse(new Vector2(2, -2f));
                    sacrificeState = SacrificeState.Unpossessed;
                    rightOfWay     = RightOfWay.Default;
                }

                sacrifice.IgnoreCollisionWith(truckAngelCollisionBox);
                sacrifice.IgnoreCollisionWith(truckDemonCollisionBox);
                sacrifice.IgnoreCollisionWith(_wheelBackAngel);
                sacrifice.IgnoreCollisionWith(_wheelFrontAngel);
                sacrifice.IgnoreCollisionWith(_wheelBackDemon);
                sacrifice.IgnoreCollisionWith(_wheelFrontDemon);

                break;

            case SacrificeState.Possessed:
                sacrifice.IgnoreCollisionWith(truckAngelCollisionBox);
                sacrifice.IgnoreCollisionWith(truckDemonCollisionBox);
                sacrifice.IgnoreCollisionWith(_wheelBackAngel);
                sacrifice.IgnoreCollisionWith(_wheelFrontAngel);
                sacrifice.IgnoreCollisionWith(_wheelBackDemon);
                sacrifice.IgnoreCollisionWith(_wheelFrontDemon);

                break;

            case SacrificeState.Unpossessed:
                sacrifice.RestoreCollisionWith(truckAngelCollisionBox);
                sacrifice.RestoreCollisionWith(truckDemonCollisionBox);
                sacrifice.RestoreCollisionWith(_wheelBackAngel);
                sacrifice.RestoreCollisionWith(_wheelFrontAngel);
                sacrifice.RestoreCollisionWith(_wheelBackDemon);
                sacrifice.RestoreCollisionWith(_wheelFrontDemon);

                sacrificeFrameNum++;
                if (sacrificeFrameNum / 10 >= 2)
                {
                    sacrificeFrameNum = 0;
                }

                if (rightOfWay != RightOfWay.Init)
                {
                    rightOfWay = RightOfWay.Default;
                }

                break;
            }

            switch (angelState)
            {
            case TruckState.Default:
                angelTruckFrameNum        = 0;
                instructionAngel.IsActive = false;
                break;

            case TruckState.HasRightOfWay:
                angelTruckFrameNum++;
                if (angelTruckFrameNum / 10 >= 2)
                {
                    angelTruckFrameNum = 0;
                }
                instructionAngel.IsActive = true;
                instructionDemon.IsActive = false;
                wallLeft.Position         = new Vector2(truckAngelCollisionBox.Position.X - 15, 10);
                wallRight.Position        = new Vector2(truckAngelCollisionBox.Position.X + 5, 10);
                break;

            case TruckState.Dead:
                angelTruckFrameNum++;
                if (angelTruckFrameNum / 4 >= 6)
                {
                    angelTruckFrameNum = 0;
                }
                instructionAngel.IsActive = false;
                break;

            case TruckState.Spawned:
                Reset_Angel();
                break;
            }

            switch (demonState)
            {
            case TruckState.Default:
                demonTruckFrameNum        = 0;
                instructionDemon.IsActive = false;
                break;

            case TruckState.HasRightOfWay:
                demonTruckFrameNum++;
                if (demonTruckFrameNum / 10 >= 2)
                {
                    demonTruckFrameNum = 0;
                }
                instructionDemon.IsActive = true;
                instructionAngel.IsActive = false;

                wallLeft.Position  = new Vector2(truckDemonCollisionBox.Position.X - 5, 10);
                wallRight.Position = new Vector2(truckDemonCollisionBox.Position.X + 15, 10);
                break;

            case TruckState.Dead:
                demonTruckFrameNum++;
                if (demonTruckFrameNum / 4 >= 6)
                {
                    demonTruckFrameNum = 0;
                }
                instructionDemon.IsActive = false;
                break;

            case TruckState.Spawned:
                Reset_Demon();
                break;
            }

            switch (rightOfWay)
            {
            case RightOfWay.Angel:
                cameraTarget       = CameraTarget.Angel;
                wallLeft.IsSensor  = true;
                wallRight.IsSensor = true;
                break;

            case RightOfWay.Demon:
                cameraTarget       = CameraTarget.Demon;
                wallLeft.IsSensor  = true;
                wallRight.IsSensor = true;
                break;

            case RightOfWay.Default:
                cameraTarget       = CameraTarget.Lock;
                wallLeft.IsSensor  = false;
                wallRight.IsSensor = false;
                break;

            case RightOfWay.Init:
                cameraTarget       = CameraTarget.Init;
                wallLeft.IsSensor  = false;
                wallRight.IsSensor = false;
                break;
            }

            camera.Update(gameTime);

            angelVictoryGoal.Update(gameTime);
            demonVictoryGoal.Update(gameTime);
            base.Update(gameTime);
            //Console.WriteLine(angelState);
        }