Пример #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
        public void OnEnterCollision(Collision2D col)
        {
//            Debug.Log("ground hit");
            if (StaticUtilities.CheckIdentity <Ground>(col.gameObject))
            {
                if (!isLocked)
                {
                    ratBrain.SetState(ratBrain.AvailableStates[typeof(UpAndActive)]);
                }
            }
        }
Пример #4
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);
                    }
                }
            }
        }
Пример #5
0
        public void OnTrigger(Collider2D trigger)
        {
            Debug.Log((CurrentlyActive + " currently active" + this.GetType()));
            Debug.Log("trigger fired: " + this.GetType());

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

                    if (bc.currentState.BouncerKnockable())
                    {
                        OnKnockTarget?.Invoke(trigger.gameObject);
                    }
                }
            }
        }
Пример #6
0
 public void OnStayCollision(Collision2D col)
 {
     if (StaticUtilities.CheckIdentity <Ground>(col.gameObject))
     {
         foreach (ContactPoint2D contactPoint in col.contacts)
         {
             if (StaticUtilities.CheckIdentity <Ground>(contactPoint.collider.gameObject))
             {
                 if (HitTheGroundAtCorrectAngle(contactPoint.normal))
                 {
                     ratBrain.SetState(ratBrain.AvailableStates[typeof(UpAndActive)]);
                     ratBrain.SetAnimationState(ratBrain.AvailableAnimationStates[typeof(Idle)]);
                 }
                 // Debug.DrawRay(rayOrigin, contactPoint.relativeVelocity, Color.blue, 5f);
             }
         }
     }
 }
Пример #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);
                    }
                }
            }
        }