private void OnHoldable(Holdable h)
        {
            bool flag = h.HitSpring(this);

            if (flag)
            {
                BounceAnimate();
                TryBreak();
                if (h.Entity is Glider)
                {
                    Glider glider = h.Entity as Glider;
                    if (Orientation == Orientations.Floor)
                    {
                        glider.Speed.Y *= speedMult.Y;
                    }
                    else
                    {
                        glider.Speed *= speedMult;
                    }
                }
                else if (h.Entity is TheoCrystal)
                {
                    TheoCrystal theo = h.Entity as TheoCrystal;//.Speed = theoSpeed;
                    if (Orientation == Orientations.Floor)
                    {
                        theo.Speed.Y *= speedMult.Y;
                    }
                    else
                    {
                        theo.Speed *= speedMult;
                    }
                }
            }
        }
Exemple #2
0
        public void UpdateState()
        {
            bool shouldBeActive = indices.Contains(counter);

            if (shouldBeActive)
            {
                TheoCrystal theoCrystal = this.CollideFirst <TheoCrystal>();
                Player      player      = this.CollideFirst <Player>();

                if (player == null && theoCrystal == null)
                {
                    Depth      = -9990;
                    Collidable = true;
                    active     = true;

                    renderColor = Color.Red;
                }
                else
                {
                    renderColor = Color.Yellow;
                }
            }
            else
            {
                Depth      = 8990;
                Collidable = false;
                active     = false;

                renderColor = Color.Green;
            }
        }
        private bool TheoIsNearby()
        {
            TheoCrystal theoCrystal = Scene.Tracker.GetEntity <TheoCrystal>();

            if (theoCrystal != null && theoCrystal.X >= X - 10.0)
            {
                return(Vector2.DistanceSquared(holdingCheckFrom, theoCrystal.Center) <
                       (open ? HoldingCloseDistSq : HoldingOpenDistSq));
            }

            return(true);
        }
        public bool BlockedCheck()
        {
            TheoCrystal theoCrystal = CollideFirst <TheoCrystal>();
            bool        flag        = theoCrystal != null && !TryActorWiggleUp(theoCrystal);
            bool        result;

            if (flag)
            {
                result = true;
            }
            else
            {
                Player player = CollideFirst <Player>();
                bool   flag2  = player != null && !TryActorWiggleUp(player);
                result = flag2;
            }
            return(result);
        }
        private IEnumerator CloseBehindPlayerAndTheo()
        {
            TempleGateReversed templeGateReversed = this;

            while (true)
            {
                Player player = templeGateReversed.Scene.Tracker.GetEntity <Player>();
                if (player != null && player.Right < templeGateReversed.Left - MinDrawHeight)
                {
                    TheoCrystal theoCrystal = templeGateReversed.Scene.Tracker.GetEntity <TheoCrystal>();
                    if (!templeGateReversed.lockState && theoCrystal != null &&
                        theoCrystal.Right < templeGateReversed.Left - MinDrawHeight)
                    {
                        break;
                    }
                }

                yield return(null);
            }

            templeGateReversed.Close();
        }
Exemple #6
0
        private void OnHoldable(Holdable h)
        {
            if (h.Entity is TheoCrystal)
            {
                TheoCrystal theoCrystal = h.Entity as TheoCrystal;
                theoCrystal.RemoveSelf();
                theoCount++;

                GameData.Instance.minigameStatus[GameData.Instance.realPlayerID] = theoCount;
                MultiplayerSingleton.Instance.Send(new MinigameStatus {
                    results = theoCount
                });
                if (theoCount >= THEOS_NEEDED && endCoroutine == null)
                {
                    Add(endCoroutine = new Coroutine(EndMinigame()));
                }
                else
                {
                    level.Add(new TheoCrystal(theoRespawnPoint));
                }
            }
        }
 private void OnTheoCrystal(TheoCrystal theo)
 {
     TurnOn();
 }
        private static void TheoCrystalOnUpdate(On.Celeste.TheoCrystal.orig_Update orig, TheoCrystal self)
        {
            if (self.GetType() != typeof(TheoCrystal))
            {
                orig(self);
                return;
            }

            List <Entity> theoCrystalBarrier = self.Scene.Tracker.GetEntities <TheoCrystalBarrier>().ToList();

            theoCrystalBarrier.ForEach(entity => entity.Collidable = true);
            orig(self);
            theoCrystalBarrier.ForEach(entity => entity.Collidable = false);
        }