예제 #1
0
        void Update()
        {
            AnimatedTvariable();

            if (searching)
            {
                if (gm.GetService <LightsController>().lightsOn)
                {
                    CastSearchingRay();

                    if (searchRayResult.collider != null)
                    {
                        Collider2D col = searchRayResult.collider;

                        if (StaticUtilities.CheckIdentity <Ground>(col.gameObject))
                        {
                            return;
                        }

                        if (StaticUtilities.CheckIdentity <RatbagPlayerBrain>(col.gameObject))
                        {
                            foreach (ITargetUpdatable targetter in targettingComponents)
                            {
                                targetter.TargetFound(col.gameObject);
                            }
                        }
                    }
                }
            }
        }
예제 #2
0
        private void Update()
        {
            if (target != null)
            {
                if (!darknessLock)
                {
                    darknessLock = true;
                }

                if (target == null)
                {
                    if (!gm.GetService <LightsController>().lightsOn)
                    {
                        darknessLock = false;
                    }
                }
                if (StaticUtilities.CheckIdentity <RatbagPlayerBrain>(target))
                {
                    Vector2 targetFacingDirection = target.GetComponent <FaceDirection>().direction;

                    if (bouncerFacingDirection == targetFacingDirection)
                    {
                        Charge(chargeSpeed);
                        // print("charge firing: " + chargeSpeed);

                        for (int i = 0; i < componentsToUpdate.Length; i++)
                        {
                            IChargeUpdatable componentToUpdate = componentsToUpdate[i];
                            componentToUpdate.OnBouncerCharge();
                        }
                    }
                }
            }
        }
예제 #3
0
        private void KnockingTheTarget(GameObject target)
        {
            StartCoroutine(gm.GetService <DamageEffects>().PauseGameAndInvertColours());

            Rigidbody2D targetRb = target.GetComponentInParent <Rigidbody2D>() ?? throw new ArgumentNullException("target.GetComponentInParent<Rigidbody2D>()");

            if (playerRb.velocity.magnitude != 0)
            {
                AddForce_WhenPlayerMoving(targetRb);
            }
            else
            {
                AddForce_WhenPlayerStill(targetRb);
            }

            OnSoundPlayOneShot?.Invoke(audioLib.ratbag_Hitting);
        }
예제 #4
0
        private void ChangeWeighting(float newWeight)
        {
            targetWeighting = newWeight;

            if (targetWeighting != CurrentWeighting)
            {
                CurrentWeighting = targetWeighting;

                if (changeWeightCoRoutine != null)
                {
                    StopCoroutine(changeWeightCoRoutine);
                }

                changeWeightCoRoutine = gm.GetService <GroupTargetBrokerSmashBrosCamera>().ChangeCamTargetWeight(transform, CurrentWeighting);

                StartCoroutine(changeWeightCoRoutine);
            }
        }
예제 #5
0
        public void TripTarget(GameObject target)
        {
            Rigidbody2D targetRb = target.GetComponent <Rigidbody2D>();

            float torqueToAdd = targetRb.velocity.magnitude * tripForce;

            // Debug.Log("target tripped, torque added: " + torqueToAdd);

            targetRb.AddTorque(torqueToAdd);

            StartCoroutine(gm.GetService <CameraShake>().ShakingCamera(.1f, targetRb.velocity.magnitude / 4, targetRb.velocity.magnitude));
        }
예제 #6
0
        public void OnTrigger(Collider2D trigger)
        {
            if (StaticUtilities.CheckIdentity <Controllers.Bouncer>(trigger.gameObject))
            {
                Controllers.Bouncer bc = StaticUtilities.ReturnControllerFromTrigger <Controllers.Bouncer>(trigger);

                if (!gm.GetService <LightsController>().lightsOn)
                {
                    if (bc.currentState.BouncerKnockable())
                    {
                        OnKnockTarget?.Invoke(trigger.gameObject);
                    }
                }
            }
        }
예제 #7
0
        public void OnTrigger(Collider2D trigger)
        {
//            Debug.Log("triggered: " + trig.gameObject.name);

            if (StaticUtilities.CheckIdentity <Controllers.Bouncer>(trigger.gameObject))
            {
                Controllers.Bouncer bc = trigger.gameObject.GetComponentInParent <Controllers.Bouncer>();

//                Debug.Log("bc = " + bc + " || lights on: " + gm.GetService<LightsController>().lightsOn);

                if (!gm.GetService <LightsController>().lightsOn)
                {
                    if (bc.currentState.BouncerKnockable())
                    {
                        OnKnockTarget?.Invoke(trigger.gameObject);
                    }
                }
            }
        }
예제 #8
0
 private void GetTimerDefaultFromResetService()
 {
     timerDefault = gm.GetService <GameReset>().GetSpawningTime();
 }
예제 #9
0
 private void CallingGameReset(GameObject player)
 {
     StartCoroutine(gm.GetService <GameReset>().ResetPlayer(player));
 }