Example #1
0
    public static void RunAll(DelayedDelegateGameObject method)
    {
        for (int x = delayedDelegatesGameObject.Count - 1; x >= 0; x--)
        {
            if (delayedDelegatesGameObject[x] == method)
            {
                delayedDelegatesTimeGameObject[x] = Time.fixedTime;
            }
        }

        DelayedDelegates.RunDelegates();
    }
Example #2
0
    public static void RunAll(DelayedDelegateCollider method)
    {
        for (int x = delayedDelegatesCollider.Count - 1; x >= 0; x--)
        {
            if (delayedDelegatesCollider[x] == method)
            {
                delayedDelegatesTimeCollider[x] = Time.fixedTime;
            }
        }

        DelayedDelegates.RunDelegates();
    }
Example #3
0
    public static void RunAll(DelayedDelegateVector2 method)
    {
        for (int x = delayedDelegatesVector2.Count - 1; x >= 0; x--)
        {
            if (delayedDelegatesVector2[x] == method)
            {
                delayedDelegatesTimeVector2[x] = Time.fixedTime;
            }
        }

        DelayedDelegates.RunDelegates();
    }
Example #4
0
    public static void RunAll(DelayedDelegateString method)
    {
        for (int x = delayedDelegatesString.Count - 1; x >= 0; x--)
        {
            if (delayedDelegatesString[x] == method)
            {
                delayedDelegatesTimeString[x] = Time.fixedTime;
            }
        }

        DelayedDelegates.RunDelegates();
    }
Example #5
0
    public static void RunAll(DelayedDelegateParameters method)
    {
        for (int x = delayedDelegatesParams.Count - 1; x >= 0; x--)
        {
            if (delayedDelegatesParams[x] == method)
            {
                delayedDelegatesTimeParams[x] = Time.fixedTime;
            }
        }

        DelayedDelegates.RunDelegates();
    }
Example #6
0
    public static void RunAll()
    {
        for (int x = delayedDelegates.Count - 1; x >= 0; x--)
        {
            delayedDelegatesTime[x]     = Time.fixedTime;
            delayedDelegatesRealtime[x] = false;
            delayedDelegatesFrame[x]    = 0;
        }

        for (int x = delayedDelegatesParams.Count - 1; x >= 0; x--)
        {
            delayedDelegatesTimeParams[x] = Time.fixedTime;
        }

        for (int x = delayedDelegatesInt.Count - 1; x >= 0; x--)
        {
            delayedDelegatesTimeInt[x] = Time.fixedTime;
        }

        for (int x = delayedDelegatesString.Count - 1; x >= 0; x--)
        {
            delayedDelegatesTimeString[x] = Time.fixedTime;
        }

        for (int x = delayedDelegatesFloat.Count - 1; x >= 0; x--)
        {
            delayedDelegatesTimeFloat[x] = Time.fixedTime;
        }

        for (int x = delayedDelegatesVector3.Count - 1; x >= 0; x--)
        {
            delayedDelegatesTimeVector3[x] = Time.fixedTime;
        }

        for (int x = delayedDelegatesVector2.Count - 1; x >= 0; x--)
        {
            delayedDelegatesTimeVector2[x] = Time.fixedTime;
        }

        for (int x = delayedDelegatesGameObject.Count - 1; x >= 0; x--)
        {
            delayedDelegatesTimeGameObject[x] = Time.fixedTime;
        }

        for (int x = delayedDelegatesCollider.Count - 1; x >= 0; x--)
        {
            delayedDelegatesTimeCollider[x] = Time.fixedTime;
        }

        DelayedDelegates.RunDelegates();
    }
Example #7
0
    public static void RunAll(DelayedDelegateInt method)
    {
        for (int x = delayedDelegatesInt.Count - 1; x >= 0; x--)
        {
            if (delayedDelegatesInt[x] == method)
            {
                delayedDelegatesTimeInt[x]     = Time.fixedTime;
                delayedDelegatesIntRealtime[x] = false;
                delayedDelegatesIntFrame[x]    = 0;
            }
        }

        DelayedDelegates.RunDelegates();
    }
Example #8
0
        /** Checks if party is standing on any traps and applied changes. */
        private void checkTraps()
        {
            if (CurrentTile.Pit)
            {
                int numberOfCharactersWhoFell = 0;
                foreach (MDRCharacter character in this)
                {
                    if (character.IsDead)
                    {
                        continue;
                    }
                    if (GameRules.FallRoll(character))
                    {
                        int damage = GameRules.CalculatePitDamage(character);

                        character.ReceiveDamage(damage);

                        string message = character.IsDead ? "{0} fell down a pit, receiving {1} damage, and died." : "{0} fell down a pit receiving {1} damage.";
                        CoM.PostMessage(message, CoM.Format(character), CoM.Format(damage));
                        numberOfCharactersWhoFell++;
                    }
                    else
                    {
                        CoM.PostMessage("{0} avoided the pit.", CoM.Format(character));
                    }
                }
                if (numberOfCharactersWhoFell > 0)
                {
                    SoundManager.Play("OLDFX_FALL");
                }
            }

            if (CurrentTile.Rotator)
            {
                int turns = Util.Roll(4) + 4;

                DelayedDelegates.Add(delegate {
                    for (int lp = 0; lp < turns; lp++)
                    {
                        TurnLeft();
                    }
                    CoM.PostMessage("Party hit a rotator.");
                }, 0.1f);
            }

            if (CurrentTile.Water)
            {
                SoundManager.Play("OLDFX_WADE");
            }
            else
            {
                foreach (MDRCharacter character in this)
                {
                    character.TimeInWater = 0;
                }
            }

            if (CurrentTile.FaceEast)
            {
                Facing = Direction.EAST;
            }
            if (CurrentTile.FaceWest)
            {
                Facing = Direction.WEST;
            }
            if (CurrentTile.FaceSouth)
            {
                Facing = Direction.SOUTH;
            }
            if (CurrentTile.FaceNorth)
            {
                Facing = Direction.NORTH;
            }

            if (CurrentTile.Chute)
            {
                ChuteTrapInfo chute = Map.GetChutAt(LocationX, LocationY);
                if (chute == null)
                {
                    Trace.LogWarning("No chute found at party's current location.");
                }
                else
                {
                    if ((Depth + chute.DropDepth) > Dungeon.Floors)
                    {
                        CoM.PostMessage("This chute doesn't seem to go anywhere.  You can't help but feel fortunate.");
                    }
                    else
                    {
                        int numberOfCharactersWhoFell = 0;
                        foreach (MDRCharacter character in this)
                        {
                            if (character.IsDead)
                            {
                                continue;
                            }
                            if (GameRules.FallRoll(character))
                            {
                                numberOfCharactersWhoFell++;
                            }
                        }

                        if (numberOfCharactersWhoFell == LivingMembers)
                        {
                            Depth += chute.DropDepth;
                            CoM.PostMessage("Party fell down a chute");
                            SoundManager.Play("OLDFX_FALL");
                        }
                        else
                        {
                            CoM.PostMessage("Party avoided falling down a chute");
                        }
                    }
                }
            }

            if (CurrentTile.Teleporter)
            {
                TeleportTrapInfo teleport = Map.GetTeleportAt(LocationX, LocationY);
                if (teleport == null)
                {
                    Trace.LogWarning("No teleport found at party's current location.");
                }
                else
                {
                    if (teleport.DestFloor > Dungeon.Floors)
                    {
                        CoM.PostMessage("The teleport trap fizzes, but doesn't seem to do anything.");
                        return;
                    }

                    int destinationX     = teleport.DestX;
                    int destinationY     = teleport.DestY;
                    int destinationFloor = teleport.DestFloor == 0 ? Depth : teleport.DestFloor;

                    if (teleport.IsRandom())
                    {
                        int trys = 0;
                        while (true)
                        {
                            destinationX = Util.Roll(30);
                            destinationY = Util.Roll(30);
                            if (!Map.GetField(destinationX, destinationY).Rock)
                            {
                                break;
                            }
                            trys++;
                            if (trys > 999)
                            {
                                Trace.LogWarning("Could not find safe place to teleport character to.");
                                return;
                            }
                        }
                    }

                    SoundManager.Play("OLDFX_TELEPORT");

                    SetLocation(destinationX, destinationY, destinationFloor, Facing);

                    Trace.Log("Teleporting characters to " + destinationX + "," + destinationY);
                    CoM.PostMessage("Party hit a teleporter");
                }
            }
        }
Example #9
0
 void Update()
 {
     DelayedDelegates.RunDelegates();
 }