예제 #1
0
            public static void SetFlying(string id, bool isFlying)
            {
                Log.Indent();
                try
                {
                    CreatureBoardAsset creatureBoardAsset = GetCreatureBoardAsset(id);

                    if (Guard.IsNull(creatureBoardAsset, "creatureBoardAsset"))
                    {
                        return;
                    }

                    string creatureName = creatureBoardAsset.GetOnlyCreatureName();
                    if (creatureBoardAsset.IsFlying != isFlying)
                    {
                        Log.Warning($"Setting {creatureName}'s flying state to {isFlying}");
                        CreatureManager.SetCreatureFlyingState(creatureBoardAsset.CreatureId, isFlying);
                        creatureBoardAsset.EnableFlying(isFlying);
                        if (creatureBoardAsset.IsFlying != isFlying)
                        {
                            Log.Error($"Error: {creatureName} is flying state is still {creatureBoardAsset.IsFlying}.");
                        }

                        if (!isFlying)
                        {
                            Log.Debug($"creatureBoardAsset.DropAtCurrentLocation();");
                            creatureBoardAsset.DropAtCurrentLocation();
                        }
                    }
                    else
                    {
                        if (isFlying)
                        {
                            Log.Warning($"{creatureName} is already flying!");
                        }
                        else
                        {
                            Log.Warning($"{creatureName} is already grounded!");
                        }
                    }
                }
                finally
                {
                    Log.Unindent();
                }
            }