Exemplo n.º 1
0
        public override void Render(Phantom.Graphics.RenderInfo info)
        {
            this.effect.View = this.layer.Camera.View;
            this.effect.Projection = this.layer.Camera.Projection;
            this.effect.VertexColorEnabled = true;

            foreach (EffectPass pass in this.effect.CurrentTechnique.Passes)
            {
                pass.Apply();
                layer.GraphicsDevice.DrawUserPrimitives<VertexPositionColor>(PrimitiveType.LineList, vertices, 0, 3);
            }
            base.Render(info);
        }
Exemplo n.º 2
0
        public override void Render(Phantom.Graphics.RenderInfo info)
        {
            info.Canvas.FillColor = MouseOver ? GUISettings.ColorHighLight : GUISettings.ColorWindow;
            info.Canvas.StrokeColor = GUISettings.ColorShadow;
            info.Canvas.LineWidth = 2;
            Vector2 position = new Vector2(RealLeft, RealTop);
            Vector2 halfSize = new Vector2(Width*0.5f, Height*0.5f);
            info.Canvas.StrokeRect(position + halfSize, halfSize, 0);
            if (!MouseDown) position -= Vector2.One*2;
            info.Canvas.FillRect(position + halfSize, halfSize, 0);
            info.Canvas.StrokeRect(position + halfSize, halfSize, 0);

            Vector2 size = GUISettings.Font.MeasureString(Text);
            info.Batch.DrawString(GUISettings.Font, Text, position +halfSize - size*0.5f, GUISettings.ColorText);
            base.Render(info);
        }
Exemplo n.º 3
0
        public override void Render(Phantom.Graphics.RenderInfo info)
        {
            info.Canvas.FillColor = GUISettings.ColorWindow;
            info.Canvas.StrokeColor = GUISettings.ColorShadow;
            info.Canvas.LineWidth = 2;
            Vector2 position = new Vector2(RealLeft, RealTop);
            Vector2 halfSize = new Vector2(Width*0.5f, Height*0.5f);
            Vector2 captionHalfSize = new Vector2(Width * 0.5f, 10);
            info.Canvas.FillRect(position + halfSize, halfSize, 0);
            info.Canvas.StrokeRect(position + halfSize, halfSize, 0);
            info.Canvas.FillColor = GUISettings.ColorShadow;
            info.Canvas.FillRect(position + captionHalfSize, captionHalfSize, 0);

            Vector2 size = GUISettings.Font.MeasureString(Text);
            info.Batch.DrawString(GUISettings.Font, Text, position + new Vector2(5, 10 - size.Y*0.5f), GUISettings.ColorHighLight);
            base.Render(info);
        }
Exemplo n.º 4
0
            public static void Postfix([HarmonyArgument(0)] byte callId, [HarmonyArgument(1)] MessageReader reader)
            {
                //if (callId >= 43) //System.Console.WriteLine("Received " + callId);
                byte  readByte, readByte1, readByte2;
                sbyte readSByte, readSByte2;

                switch ((CustomRPC)callId)
                {
                case CustomRPC.SetMayor:
                    readByte = reader.ReadByte();
                    new Mayor(Utils.PlayerById(readByte));
                    break;

                case CustomRPC.SetJester:
                    readByte = reader.ReadByte();
                    new Jester(Utils.PlayerById(readByte));
                    break;

                case CustomRPC.SetSheriff:
                    readByte = reader.ReadByte();
                    new Sheriff(Utils.PlayerById(readByte));
                    break;

                case CustomRPC.SetEngineer:
                    readByte = reader.ReadByte();
                    new Engineer(Utils.PlayerById(readByte));
                    break;


                case CustomRPC.SetJanitor:
                    new Janitor(Utils.PlayerById(reader.ReadByte()));

                    break;

                case CustomRPC.SetSwapper:
                    readByte = reader.ReadByte();
                    new Swapper(Utils.PlayerById(readByte));
                    break;

                case CustomRPC.SetShifter:
                    readByte = reader.ReadByte();
                    new Shifter(Utils.PlayerById(readByte));
                    break;

                case CustomRPC.SetInvestigator:
                    readByte = reader.ReadByte();
                    new Investigator(Utils.PlayerById(readByte));
                    break;

                case CustomRPC.SetTimeLord:
                    readByte = reader.ReadByte();
                    new TimeLord(Utils.PlayerById(readByte));
                    break;

                case CustomRPC.SetTorch:
                    readByte = reader.ReadByte();
                    new Torch(Utils.PlayerById(readByte));
                    break;

                case CustomRPC.SetDiseased:
                    readByte = reader.ReadByte();
                    new Diseased(Utils.PlayerById(readByte));
                    break;

                case CustomRPC.SetFlash:
                    readByte = reader.ReadByte();
                    new Flash(Utils.PlayerById(readByte));
                    break;

                case CustomRPC.SetMedic:
                    readByte = reader.ReadByte();
                    new Medic(Utils.PlayerById(readByte));
                    break;

                case CustomRPC.SetMorphling:
                    readByte = reader.ReadByte();
                    new Morphling(Utils.PlayerById(readByte));
                    break;

                case CustomRPC.LoveWin:
                    var winnerlover = Utils.PlayerById(reader.ReadByte());
                    Role.GetRole <Lover>(winnerlover).Win();
                    break;


                case CustomRPC.JesterLose:
                    foreach (var role in Role.AllRoles)
                    {
                        if (role.RoleType == RoleEnum.Jester)
                        {
                            ((Jester)role).Loses();
                        }
                    }

                    break;

                case CustomRPC.PhantomLose:
                    foreach (var role in Role.AllRoles)
                    {
                        if (role.RoleType == RoleEnum.Phantom)
                        {
                            ((Phantom)role).Loses();
                        }
                    }

                    break;


                case CustomRPC.GlitchLose:
                    foreach (var role in Role.AllRoles)
                    {
                        if (role.RoleType == RoleEnum.Glitch)
                        {
                            ((Glitch)role).Loses();
                        }
                    }

                    break;

                case CustomRPC.ShifterLose:
                    foreach (var role in Role.AllRoles)
                    {
                        if (role.RoleType == RoleEnum.Shifter)
                        {
                            ((Shifter)role).Loses();
                        }
                    }

                    break;

                case CustomRPC.ExecutionerLose:
                    foreach (var role in Role.AllRoles)
                    {
                        if (role.RoleType == RoleEnum.Executioner)
                        {
                            ((Executioner)role).Loses();
                        }
                    }

                    break;

                case CustomRPC.NobodyWins:
                    Role.NobodyWinsFunc();
                    break;

                case CustomRPC.SetCouple:
                    var id     = reader.ReadByte();
                    var id2    = reader.ReadByte();
                    var b1     = reader.ReadByte();
                    var lover1 = Utils.PlayerById(id);
                    var lover2 = Utils.PlayerById(id2);

                    var roleLover1 = new Lover(lover1, 1, b1 == 0);
                    var roleLover2 = new Lover(lover2, 2, b1 == 0);

                    roleLover1.OtherLover = roleLover2;
                    roleLover2.OtherLover = roleLover1;

                    break;

                case CustomRPC.Start:
                    /*
                     * EngineerMod.PerformKill.UsedThisRound = false;
                     * EngineerMod.PerformKill.SabotageTime = DateTime.UtcNow.AddSeconds(-100);
                     */
                    Utils.ShowDeadBodies = false;
                    Murder.KilledPlayers.Clear();
                    Role.NobodyWins = false;
                    RecordRewind.points.Clear();
                    KillButtonTarget.DontRevive = byte.MaxValue;
                    break;

                case CustomRPC.JanitorClean:
                    readByte1 = reader.ReadByte();
                    var janitorPlayer = Utils.PlayerById(readByte1);
                    var janitorRole   = Role.GetRole <Janitor>(janitorPlayer);
                    readByte = reader.ReadByte();
                    var deadBodies = Object.FindObjectsOfType <DeadBody>();
                    foreach (var body in deadBodies)
                    {
                        if (body.ParentId == readByte)
                        {
                            Coroutines.Start(Coroutine.CleanCoroutine(body, janitorRole));
                        }
                    }

                    break;

                case CustomRPC.EngineerFix:
                    var engineer = Utils.PlayerById(reader.ReadByte());
                    Role.GetRole <Engineer>(engineer).UsedThisRound = true;
                    break;


                case CustomRPC.FixLights:
                    var lights = ShipStatus.Instance.Systems[SystemTypes.Electrical].Cast <SwitchSystem>();
                    lights.ActualSwitches = lights.ExpectedSwitches;
                    break;

                case CustomRPC.SetExtraVotes:

                    var mayor     = Utils.PlayerById(reader.ReadByte());
                    var mayorRole = Role.GetRole <Mayor>(mayor);
                    mayorRole.ExtraVotes = reader.ReadBytesAndSize().ToList();
                    if (!mayor.Is(RoleEnum.Mayor))
                    {
                        mayorRole.VoteBank -= mayorRole.ExtraVotes.Count;
                    }

                    break;

                case CustomRPC.SetSwaps:
                    readSByte       = reader.ReadSByte();
                    SwapVotes.Swap1 =
                        MeetingHud.Instance.playerStates.FirstOrDefault(x => x.TargetPlayerId == readSByte);
                    readSByte2      = reader.ReadSByte();
                    SwapVotes.Swap2 =
                        MeetingHud.Instance.playerStates.FirstOrDefault(x => x.TargetPlayerId == readSByte2);
                    PluginSingleton <TownOfUs> .Instance.Log.LogMessage("Bytes received - " + readSByte + " - " +
                                                                        readSByte2);

                    break;

                case CustomRPC.Shift:
                    readByte1 = reader.ReadByte();
                    readByte2 = reader.ReadByte();
                    var shifter = Utils.PlayerById(readByte1);
                    var other   = Utils.PlayerById(readByte2);
                    PerformKillButton.Shift(Role.GetRole <Shifter>(shifter), other);
                    break;

                case CustomRPC.Rewind:
                    readByte = reader.ReadByte();
                    var TimeLordPlayer = Utils.PlayerById(readByte);
                    var TimeLordRole   = Role.GetRole <TimeLord>(TimeLordPlayer);
                    StartStop.StartRewind(TimeLordRole);
                    break;

                case CustomRPC.Protect:
                    readByte1 = reader.ReadByte();
                    readByte2 = reader.ReadByte();

                    var medic  = Utils.PlayerById(readByte1);
                    var shield = Utils.PlayerById(readByte2);
                    Role.GetRole <Medic>(medic).ShieldedPlayer = shield;
                    Role.GetRole <Medic>(medic).UsedAbility    = true;
                    break;

                case CustomRPC.RewindRevive:
                    readByte = reader.ReadByte();
                    RecordRewind.ReviveBody(Utils.PlayerById(readByte));
                    break;

                case CustomRPC.AttemptSound:
                    var medicId = reader.ReadByte();
                    readByte = reader.ReadByte();
                    StopKill.BreakShield(medicId, readByte, CustomGameOptions.ShieldBreaks);
                    break;

                case CustomRPC.SetGlitch:
                    var GlitchId     = reader.ReadByte();
                    var GlitchPlayer = Utils.PlayerById(GlitchId);
                    new Glitch(GlitchPlayer);
                    break;

                case CustomRPC.BypassKill:
                    var killer = Utils.PlayerById(reader.ReadByte());
                    var target = Utils.PlayerById(reader.ReadByte());

                    Utils.MurderPlayer(killer, target);
                    break;

                case CustomRPC.AssassinKill:
                    var toDie = Utils.PlayerById(reader.ReadByte());
                    AssassinKill.MurderPlayer(toDie);
                    break;

                case CustomRPC.SetMimic:
                    var glitchPlayer = Utils.PlayerById(reader.ReadByte());
                    var mimicPlayer  = Utils.PlayerById(reader.ReadByte());
                    var glitchRole   = Role.GetRole <Glitch>(glitchPlayer);
                    glitchRole.MimicTarget  = mimicPlayer;
                    glitchRole.IsUsingMimic = true;
                    Utils.Morph(glitchPlayer, mimicPlayer);
                    break;

                case CustomRPC.RpcResetAnim:
                    var animPlayer    = Utils.PlayerById(reader.ReadByte());
                    var theGlitchRole = Role.GetRole <Glitch>(animPlayer);
                    theGlitchRole.MimicTarget  = null;
                    theGlitchRole.IsUsingMimic = false;
                    Utils.Unmorph(theGlitchRole.Player);
                    break;

                case CustomRPC.GlitchWin:
                    var theGlitch = Role.AllRoles.FirstOrDefault(x => x.RoleType == RoleEnum.Glitch);
                    ((Glitch)theGlitch)?.Wins();
                    break;

                case CustomRPC.SetHacked:
                    var hackPlayer = Utils.PlayerById(reader.ReadByte());
                    if (hackPlayer.PlayerId == PlayerControl.LocalPlayer.PlayerId)
                    {
                        var glitch = Role.AllRoles.FirstOrDefault(x => x.RoleType == RoleEnum.Glitch);
                        ((Glitch)glitch)?.SetHacked(hackPlayer);
                    }

                    break;

                case CustomRPC.Investigate:
                    var seer        = Utils.PlayerById(reader.ReadByte());
                    var otherPlayer = Utils.PlayerById(reader.ReadByte());
                    Role.GetRole <Seer>(seer).Investigated.Add(otherPlayer.PlayerId);
                    Role.GetRole <Seer>(seer).LastInvestigated = DateTime.UtcNow;
                    break;

                case CustomRPC.SetSeer:
                    new Seer(Utils.PlayerById(reader.ReadByte()));
                    break;

                case CustomRPC.Morph:
                    var morphling   = Utils.PlayerById(reader.ReadByte());
                    var morphTarget = Utils.PlayerById(reader.ReadByte());
                    var morphRole   = Role.GetRole <Morphling>(morphling);
                    morphRole.TimeRemaining = CustomGameOptions.MorphlingDuration;
                    morphRole.MorphedPlayer = morphTarget;
                    break;

                case CustomRPC.SetExecutioner:
                    new Executioner(Utils.PlayerById(reader.ReadByte()));
                    break;

                case CustomRPC.SetTarget:
                    var executioner = Utils.PlayerById(reader.ReadByte());
                    var exeTarget   = Utils.PlayerById(reader.ReadByte());
                    var exeRole     = Role.GetRole <Executioner>(executioner);
                    exeRole.target = exeTarget;
                    break;

                case CustomRPC.SetCamouflager:
                    new Camouflager(Utils.PlayerById(reader.ReadByte()));
                    break;

                case CustomRPC.Camouflage:
                    var camouflager     = Utils.PlayerById(reader.ReadByte());
                    var camouflagerRole = Role.GetRole <Camouflager>(camouflager);
                    camouflagerRole.TimeRemaining = CustomGameOptions.CamouflagerDuration;
                    Utils.Camouflage();
                    break;

                case CustomRPC.SetSpy:
                    new Spy(Utils.PlayerById(reader.ReadByte()));
                    break;

                case CustomRPC.ExecutionerToJester:
                    TargetColor.ExeToJes(Utils.PlayerById(reader.ReadByte()));
                    break;

                case CustomRPC.SetSnitch:
                    new Snitch(Utils.PlayerById(reader.ReadByte()));
                    break;

                case CustomRPC.SetMiner:
                    new Miner(Utils.PlayerById(reader.ReadByte()));
                    break;

                case CustomRPC.Mine:
                    var ventId    = reader.ReadInt32();
                    var miner     = Utils.PlayerById(reader.ReadByte());
                    var minerRole = Role.GetRole <Miner>(miner);
                    var pos       = reader.ReadVector2();
                    var zAxis     = reader.ReadSingle();
                    PerformKill.SpawnVent(ventId, minerRole, pos, zAxis);
                    break;

                case CustomRPC.SetSwooper:
                    new Swooper(Utils.PlayerById(reader.ReadByte()));
                    break;

                case CustomRPC.Swoop:
                    var swooper     = Utils.PlayerById(reader.ReadByte());
                    var swooperRole = Role.GetRole <Swooper>(swooper);
                    swooperRole.TimeRemaining = CustomGameOptions.SwoopDuration;
                    swooperRole.Swoop();
                    break;

                case CustomRPC.SetTiebreaker:
                    new Tiebreaker(Utils.PlayerById(reader.ReadByte()));
                    break;

                case CustomRPC.SetDrunk:
                    new Drunk(Utils.PlayerById(reader.ReadByte()));
                    break;

                case CustomRPC.SetArsonist:
                    new Arsonist(Utils.PlayerById(reader.ReadByte()));
                    break;

                case CustomRPC.Douse:
                    var arsonist     = Utils.PlayerById(reader.ReadByte());
                    var douseTarget  = Utils.PlayerById(reader.ReadByte());
                    var arsonistRole = Role.GetRole <Arsonist>(arsonist);
                    arsonistRole.DousedPlayers.Add(douseTarget.PlayerId);
                    arsonistRole.LastDoused = DateTime.UtcNow;

                    break;

                case CustomRPC.Ignite:
                    var theArsonist     = Utils.PlayerById(reader.ReadByte());
                    var theArsonistRole = Role.GetRole <Arsonist>(theArsonist);
                    global::TownOfUs.NeutralRoles.ArsonistMod.PerformKill.Ignite(theArsonistRole);
                    break;

                case CustomRPC.ArsonistWin:
                    var theArsonistTheRole = Role.AllRoles.FirstOrDefault(x => x.RoleType == RoleEnum.Arsonist);
                    ((Arsonist)theArsonistTheRole)?.Wins();
                    break;

                case CustomRPC.ArsonistLose:
                    foreach (var role in Role.AllRoles)
                    {
                        if (role.RoleType == RoleEnum.Arsonist)
                        {
                            ((Arsonist)role).Loses();
                        }
                    }

                    break;

                case CustomRPC.SetImpostor:
                    new Impostor(Utils.PlayerById(reader.ReadByte()));
                    break;

                case CustomRPC.SetCrewmate:
                    new Crewmate(Utils.PlayerById(reader.ReadByte()));
                    break;

                case CustomRPC.SyncCustomSettings:
                    Rpc.ReceiveRpc(reader);
                    break;

                case CustomRPC.SetAltruist:
                    new Altruist(Utils.PlayerById(reader.ReadByte()));
                    break;

                case CustomRPC.SetBigBoi:
                    new BigBoiModifier(Utils.PlayerById(reader.ReadByte()));
                    break;

                case CustomRPC.AltruistRevive:
                    readByte1 = reader.ReadByte();
                    var altruistPlayer = Utils.PlayerById(readByte1);
                    var altruistRole   = Role.GetRole <Altruist>(altruistPlayer);
                    readByte = reader.ReadByte();
                    var theDeadBodies = Object.FindObjectsOfType <DeadBody>();
                    foreach (var body in theDeadBodies)
                    {
                        if (body.ParentId == readByte)
                        {
                            if (body.ParentId == PlayerControl.LocalPlayer.PlayerId)
                            {
                                Coroutines.Start(Utils.FlashCoroutine(altruistRole.Color,
                                                                      CustomGameOptions.ReviveDuration, 0.5f));
                            }

                            Coroutines.Start(
                                global::TownOfUs.CrewmateRoles.AltruistMod.Coroutine.AltruistRevive(body,
                                                                                                    altruistRole));
                        }
                    }

                    break;

                case CustomRPC.FixAnimation:
                    var player = Utils.PlayerById(reader.ReadByte());
                    player.MyPhysics.ResetMoveState();
                    player.Collider.enabled     = true;
                    player.moveable             = true;
                    player.NetTransform.enabled = true;
                    break;

                case CustomRPC.SetButtonBarry:
                    new ButtonBarry(Utils.PlayerById(reader.ReadByte()));
                    break;

                case CustomRPC.BarryButton:
                    var buttonBarry = Utils.PlayerById(reader.ReadByte());
                    if (AmongUsClient.Instance.AmHost)
                    {
                        MeetingRoomManager.Instance.reporter = buttonBarry;
                        MeetingRoomManager.Instance.target   = null;
                        AmongUsClient.Instance.DisconnectHandlers.AddUnique(MeetingRoomManager.Instance
                                                                            .Cast <IDisconnectHandler>());
                        if (ShipStatus.Instance.CheckTaskCompletion())
                        {
                            return;
                        }

                        DestroyableSingleton <HudManager> .Instance.OpenMeetingRoom(buttonBarry);

                        buttonBarry.RpcStartMeeting(null);
                    }

                    break;

                case CustomRPC.SetUndertaker:
                    new Undertaker(Utils.PlayerById(reader.ReadByte()));
                    break;

                case CustomRPC.Drag:
                    readByte1 = reader.ReadByte();
                    var dienerPlayer = Utils.PlayerById(readByte1);
                    var dienerRole   = Role.GetRole <Undertaker>(dienerPlayer);
                    readByte = reader.ReadByte();
                    var dienerBodies = Object.FindObjectsOfType <DeadBody>();
                    foreach (var body in dienerBodies)
                    {
                        if (body.ParentId == readByte)
                        {
                            dienerRole.CurrentlyDragging = body;
                        }
                    }

                    break;

                case CustomRPC.Drop:
                    readByte1 = reader.ReadByte();
                    var v2            = reader.ReadVector2();
                    var v2z           = reader.ReadSingle();
                    var dienerPlayer2 = Utils.PlayerById(readByte1);
                    var dienerRole2   = Role.GetRole <Undertaker>(dienerPlayer2);
                    var body2         = dienerRole2.CurrentlyDragging;
                    dienerRole2.CurrentlyDragging = null;

                    body2.transform.position = new Vector3(v2.x, v2.y, v2z);


                    break;

                case CustomRPC.SetAssassin:
                    new Assassin(Utils.PlayerById(reader.ReadByte()));
                    break;

                case CustomRPC.SetUnderdog:
                    new Underdog(Utils.PlayerById(reader.ReadByte()));
                    break;

                case CustomRPC.SetPhantom:
                    readByte = reader.ReadByte();
                    SetPhantom.WillBePhantom = readByte == byte.MaxValue ? null : Utils.PlayerById(readByte);
                    break;

                case CustomRPC.PhantomDied:
                    var phantom = SetPhantom.WillBePhantom;
                    Role.RoleDictionary.Remove(phantom.PlayerId);
                    var phantomRole = new Phantom(phantom);
                    phantomRole.RegenTask();
                    phantom.gameObject.layer = LayerMask.NameToLayer("Players");
                    SetPhantom.RemoveTasks(phantom);
                    SetPhantom.AddCollider(phantomRole);
                    PlayerControl.LocalPlayer.MyPhysics.ResetMoveState();
                    System.Console.WriteLine("Become Phantom - Users");
                    break;

                case CustomRPC.CatchPhantom:
                    var phantomPlayer = Utils.PlayerById(reader.ReadByte());
                    Role.GetRole <Phantom>(phantomPlayer).Caught = true;
                    break;

                case CustomRPC.PhantomWin:
                    Role.GetRole <Phantom>(Utils.PlayerById(reader.ReadByte())).CompletedTasks = true;
                    break;

                case CustomRPC.AddMayorVoteBank:
                    Role.GetRole <Mayor>(Utils.PlayerById(reader.ReadByte())).VoteBank += reader.ReadInt32();
                    break;
                }
            }
Exemplo n.º 5
0
        public override IEnumerator <float> LevelScript()
        {
            manager.thisScene.fader.LerpColor(Color.Transparent, 1f);
            Enemy e;

            AudioManager.PlaySong(Level5Theme, false, .5f);

            yield return(2f);

            TitleShown = true;
            manager.thisScene.LerpTitleColor(Color.White, 1.5f);
            yield return(1.5f);

            yield return(2.5f);

            manager.thisScene.LerpTitleColor(Color.Transparent, 1f);
            yield return(1f);

            TitleShown = false;

            List <Enemy> tortoiseRaid = new List <Enemy>();

            // Spawn the initial turtle raid.
            e = SpawnEnemyAtAngle(EnemyType.Tortoise, new Vector2(100, -40), (float)(Math.PI / 8f) * 3, 30f);
            e.CustomValue1 = .6f;
            e.CustomValue2 = 45;
            e.CustomValue3 = .06f;
            e.CustomValue4 = 2.8f;
            e.LerpVelocity(0f, 10f);
            scriptManager.Execute(TortoiseBarage, e);
            tortoiseRaid.Add(e);

            e = SpawnEnemyAtAngle(EnemyType.Tortoise, new Vector2(600, -40), (float)(Math.PI / 8f) * 5, 30f);
            e.CustomValue1 = .6f;
            e.CustomValue2 = 45;
            e.CustomValue3 = .06f;
            e.CustomValue4 = 2.8f;
            e.LerpVelocity(0f, 10f);
            scriptManager.Execute(TortoiseBarage, e);
            tortoiseRaid.Add(e);

            e = SpawnEnemyAtAngle(EnemyType.Tortoise, new Vector2(-40, 200), (float)(Math.PI / 8f) * 1, 30f);
            e.CustomValue1 = 1.2f;
            e.CustomValue2 = 45;
            e.CustomValue3 = .06f;
            e.CustomValue4 = 2.8f;
            e.LerpVelocity(0f, 10f);
            scriptManager.Execute(TortoiseBarage, e);
            tortoiseRaid.Add(e);

            e = SpawnEnemyAtAngle(EnemyType.Tortoise, new Vector2(740, 200), (float)(Math.PI / 8f) * 7, 30f);
            e.CustomValue1 = 1.2f;
            e.CustomValue2 = 45;
            e.CustomValue3 = .06f;
            e.CustomValue4 = 2.8f;
            e.LerpVelocity(0f, 10f);
            scriptManager.Execute(TortoiseBarage, e);
            tortoiseRaid.Add(e);

            // Time remaining: 148 seconds.

            yield return(4f);

            // Time remaining: 144 seconds.

            for (int i = 0; i < 8; i++)
            {
                int x;
                if (i % 2 == 0)
                {
                    x = 200;
                }
                else
                {
                    x = 500;
                }

                e          = SpawnEnemy(EnemyType.Slicer, new Vector2(x, -40));
                e.Rotation = (float)Math.PI / 2f;
                e.Velocity = 110f;
                scriptManager.Execute(SlicerSimpleShot, e);

                yield return(.75f);
            }

            // Time remaining: 138 seconds.

            yield return(2f);

            // Time remaining: 136 seconds.

            for (int i = 0; i < 6; i++)
            {
                e = SpawnEnemyAtAngle(EnemyType.Dragonfly, new Vector2(600, -40), (float)Math.PI / 2f, 130f);
                scriptManager.Execute(SeekerDragonfly, e);
                yield return(.5f);
            }

            // Time remaining: 133

            e          = SpawnEnemy(EnemyType.Komodo, new Vector2(250, -40));
            e.Rotation = (float)Math.PI / 2f;
            e.Velocity = 45f;
            e.LerpVelocity(0f, 10f);
            scriptManager.Execute(FirstKomodo, e);

            Enemy komodo1 = e;

            if (tortoiseRaid.Count > 0)
            {
                foreach (Tortoise t in tortoiseRaid)
                {
                    scriptManager.AbortObjectScripts(t);
                    t.Rotation = VectorMathHelper.GetAngleTo(manager.thisScene.player.InnerHitbox.Center, t.Center);
                    t.LerpVelocity(100f, 3f);
                }
            }

            for (int i = 0; i < 6; i++)
            {
                e = SpawnEnemyAtAngle(EnemyType.Dragonfly, new Vector2(600, -40), (float)Math.PI / 2f, 130f);
                scriptManager.Execute(SeekerDragonfly, e);
                yield return(.5f);
            }

            // Time remaining 127 (adjust for adding 3 seconds at the beginning)

            yield return(7f);

            // Time remaining 120 seconds

            for (int i = 0; i < 10; i++)
            {
                float x     = 0;
                float angle = 0f;
                if (i % 2 == 0)
                {
                    x     = -30;
                    angle = (float)(Math.PI / 5f) * 1;
                }
                else
                {
                    x     = 730;
                    angle = (float)(Math.PI / 5f) * 4;
                }

                e = SpawnEnemyAtAngle(EnemyType.Slicer, new Vector2(x, 50), angle, 100f);
                scriptManager.Execute(OneSpreadShotSlicer, e);

                yield return(.5f);
            }

            if (komodo1 != null && komodo1.Health > 0)
            {
                // Komodo is alive, so have it leave.
                scriptManager.AbortObjectScripts(komodo1);
                komodo1.Rotation = (float)Math.PI / 2f;
                komodo1.LerpVelocity(100f, 4f);
            }

            // Time remaining: 115 seconds

            yield return(4f);

            Phantom phantom1 = SpawnEnemy(EnemyType.Phantom, new Vector2(325, 50)) as Phantom;

            scriptManager.Execute(Phantom1Script, phantom1);

            // Time remaining: 111 seconds

            scrollingBackground[0].LerpSpeed(scrollingBackground[0].layerSpeed * 3, 4f);
            scrollingBackground[1].LerpSpeed(scrollingBackground[1].layerSpeed * 3, 4f);
            scrollingBackground[2].LerpSpeed(scrollingBackground[2].layerSpeed * 3, 4f);
            //scrollingBackground[3].LerpSpeed(scrollingBackground[3].layerSpeed * 3, 4f);
            //scrollingBackground[4].LerpSpeed(scrollingBackground[4].layerSpeed * 3, 4f);
            //scrollingBackground[5].LerpSpeed(scrollingBackground[5].layerSpeed * 3, 4f);

            scrollingBackground[0].LerpColor(Color.GreenYellow, 4f);

            yield return(30f);

            // Time remaining: 81 seconds

            float timeRemaining = 20f;

            int spawns = 0;

            while (timeRemaining > 0)
            {
                timeRemaining -= .5f;
                if (phantom1 == null || phantom1.Health <= 0)
                {
                    int x;
                    if (spawns % 2 == 0)
                    {
                        x = 200;
                    }
                    else
                    {
                        x = 500;
                    }

                    spawns++;

                    e          = SpawnEnemy(EnemyType.Slicer, new Vector2(x, -40));
                    e.Rotation = (float)Math.PI / 2f;
                    e.Velocity = 110f;
                    scriptManager.Execute(SlicerSimpleShot, e);
                }
                yield return(.5f);
            }

            // Time remaining: 61

            if (phantom1 != null && phantom1.Health > 0)
            {
                // Have the phantom leave if it is still alive.
                scriptManager.AbortObjectScripts(phantom1);
                scriptManager.Execute(DisposePhantom, phantom1);
            }

            yield return(1f);

            // Time remaining 60;

            // Now bring in the circle squad!
            circleSquadOrigin = manager.thisScene.player.InnerHitbox.Center;
            for (int i = 0; i < 18; i++)
            {
                float x = (float)Math.Cos((float)(Math.PI * 2 / 18f) * i) * 1000;
                float y = (float)Math.Sin((float)(Math.PI * 2 / 18f) * i) * 1000;
                e = SpawnEnemyAtAngle(EnemyType.Komodo, circleSquadOrigin + new Vector2(x, y), VectorMathHelper.GetAngleTo(circleSquadOrigin + new Vector2(x, y), circleSquadOrigin), 0f);
                e.DeletionBoundary = new Vector2(1000, 1000);

                e.CustomValue1 = i;

                // Store its start distance from the player
                e.CustomValue2 = 1000f;
                // Store its rate of angle change
                e.CustomValue3 = .8f;

                circleSquad.Add(e);
                scriptManager.Execute(CircleSquadKomodo, e);
            }

            yield return(30f);

            foreach (Enemy k in circleSquad)
            {
                scriptManager.AbortObjectScripts(k);
                scriptManager.Execute(CircleSquadDispose, k);
            }

            // Time remaining 25

            yield return(2f);

            // Time remaining 23

            for (int i = 0; i < 12; i++)
            {
                int   x     = 0;
                float angle = 0f;
                if (i % 2 == 0)
                {
                    x     = 300;
                    angle = (float)Math.PI / 6f * 4;
                }
                else
                {
                    x     = 450;
                    angle = (float)Math.PI / 6f * 2;
                }

                e = SpawnEnemyAtAngle(EnemyType.Tortoise, new Vector2(x, -40), angle, 80f);
                e.LerpVelocity(40f, 4f);
                scriptManager.Execute(FocusFireTortoise, e);

                yield return(1f);
            }

            // Time remaining 11

            yield return(8f);

            scrollingBackground[0].LerpSpeed(scrollingBackground[0].layerSpeed / 3, 4f);
            scrollingBackground[1].LerpSpeed(scrollingBackground[1].layerSpeed / 3, 4f);
            scrollingBackground[2].LerpSpeed(scrollingBackground[2].layerSpeed / 3, 4f);
            //scrollingBackground[3].LerpSpeed(scrollingBackground[3].layerSpeed / 3, 4f);
            //scrollingBackground[4].LerpSpeed(scrollingBackground[4].layerSpeed / 3, 4f);
            //scrollingBackground[5].LerpSpeed(scrollingBackground[5].layerSpeed / 3, 4f);

            scrollingBackground[0].LerpColor(Color.Red, 5.7f);

            yield return(7f);

            manager.thisScene.PlayBossWarning();
            yield return(6.6f);

            //SPAWN THE BOSS

            Boss boss = new FinalBoss(manager.thisScene, new Vector2(250f, -450f));

            BeginBossBattle(boss);

            yield return(1.5f);

            bossTheme = AudioManager.PlaySong(BossTheme);

            while (boss.Health > 0)
            {
                yield return(.03f);
            }
            // Stop the boss theme and hide the health bar
            bossTheme.Dispose();
            manager.thisScene.HideBossHealthbar();
            yield return(5f);

            scriptManager.Execute(manager.thisScene.ShowJammedWarning);
            yield return(6f);

            AudioManager.PlaySong(FinalAttackTheme, false);
            // Dispose of the health bar.

            // Do the final phase... then destroy the enemy!
            yield return(64f);

            AudioManager.PlaySoundEffect(GameScene.Explosion4Sound, 1f);
            AudioManager.PlaySoundEffect(GameScene.Explosion1Sound, .6f);
            manager.thisScene.fader.LerpColor(Color.White, .3f);
            yield return(.3f);

            boss.Destroy();

            yield return(1.5f);

            manager.thisScene.fader.LerpColor(Color.Black, 4f);

            yield return(4f);

            // THE END
            manager.thisScene.Game.ChangeScene(new TitleScene(manager.thisScene.Game));
        }
Exemplo n.º 6
0
        public IEnumerator <float> Phantom1Script(GameObject go)
        {
            Random rand = new Random();

            Phantom        phantom = (Phantom)go;
            List <Vector2> randomTeleportLocations = new List <Vector2>()
            {
                new Vector2(325, 250),
                new Vector2(125, 50),
                new Vector2(400, 50),
                new Vector2(125, 250),
                new Vector2(400, 250),
                new Vector2(400, 450),
                new Vector2(125, 450)
            };

            while (true)
            {
                scriptManager.Execute(phantom.PhaseIn, go);
                yield return(2f);

                int shots = 0;
                while (shots < 50)
                {
                    phantom.leftInnerWingCannon.FireBulletSpread((float)Math.PI / 2f, 6, 160, 200f, Color.DeepSkyBlue, BulletType.CircleSmall);
                    phantom.rightInnerWingCannon.FireBulletSpread((float)Math.PI / 2f, 6, 160, 200f, Color.DeepSkyBlue, BulletType.CircleSmall);

                    if (shots % 4 == 0)
                    {
                        phantom.mainEmitter.Rotation += .45f;
                        phantom.mainEmitter.FireBulletExplosion(25, 140f, Color.DeepSkyBlue);
                        AudioManager.PlaySoundEffect(GameScene.Shot1Sound, .8f);
                    }

                    yield return(.09f);

                    shots++;
                }

                scriptManager.Execute(phantom.PhaseOut, phantom);
                yield return(2f);

                phantom.Position = randomTeleportLocations[new Random().Next(0, randomTeleportLocations.Count)];
                scriptManager.Execute(phantom.PhaseIn, phantom);
                yield return(2f);

                int cycles = 0;

                while (cycles < 4)
                {
                    shots = 0;

                    Vector2 target = manager.thisScene.player.InnerHitbox.Center;


                    while (shots < 15)
                    {
                        AudioManager.PlaySoundEffect(GameScene.Shot2Sound, .3f);
                        phantom.leftWingCannon.FireBullet(VectorMathHelper.GetAngleTo(phantom.leftWingCannon.Center, target), 350f, Color.Lerp(Color.White, Color.Orange, .7f));
                        phantom.rightWingCannon.FireBullet(VectorMathHelper.GetAngleTo(phantom.rightWingCannon.Center, target), 350f, Color.Lerp(Color.White, Color.Orange, .7f));
                        shots++;
                        yield return(.06f);
                    }


                    shots = 0;
                    yield return(.2f);

                    while (shots < 10)
                    {
                        AudioManager.PlaySoundEffect(GameScene.Shot5Sound, .25f);
                        Bullet newBullet;
                        newBullet = phantom.leftInnerWingCannon.FireBullet(VectorMathHelper.GetAngleTo(phantom.leftInnerWingCannon.Center, manager.thisScene.player.InnerHitbox.Center), 100f, Color.DeepSkyBlue);
                        newBullet.LerpRotation(VectorMathHelper.GetAngleTo(newBullet.Center, manager.thisScene.player.InnerHitbox.Center) + (((float)rand.NextDouble() * 2) - 1f) * .7f, 4f);
                        newBullet = phantom.rightInnerWingCannon.FireBullet(VectorMathHelper.GetAngleTo(phantom.rightInnerWingCannon.Center, manager.thisScene.player.InnerHitbox.Center), 100f, Color.DeepSkyBlue);
                        newBullet.LerpRotation(VectorMathHelper.GetAngleTo(newBullet.Center, manager.thisScene.player.InnerHitbox.Center) + (((float)rand.NextDouble() * 2) - 1f) * .7f, 4f);
                        shots++;
                        yield return(.03f);
                    }

                    shots = 0;
                    cycles++;
                    yield return(.5f);
                }

                AudioManager.PlaySoundEffect(GameScene.Shot7Sound, .6f);
                phantom.mainEmitter.FireBulletExplosion(25, 225f, Color.Lerp(Color.White, Color.Orange, .7f));
                yield return(.1f);

                AudioManager.PlaySoundEffect(GameScene.Shot7Sound, .6f);
                phantom.mainEmitter.FireBulletExplosion(24, 225f, Color.Lerp(Color.White, Color.Orange, .7f));
                yield return(.1f);

                AudioManager.PlaySoundEffect(GameScene.Shot7Sound, .6f);
                phantom.mainEmitter.FireBulletExplosion(23, 225f, Color.Lerp(Color.White, Color.Orange, .7f));
                yield return(.1f);

                AudioManager.PlaySoundEffect(GameScene.Shot7Sound, .6f);
                phantom.mainEmitter.FireBulletExplosion(22, 225f, Color.Lerp(Color.White, Color.Orange, .7f));
                yield return(.1f);

                AudioManager.PlaySoundEffect(GameScene.Shot7Sound, .6f);
                phantom.mainEmitter.FireBulletExplosion(21, 225f, Color.Lerp(Color.White, Color.Orange, .7f));
                yield return(.1f);

                scriptManager.Execute(phantom.PhaseOut, phantom);
                yield return(2f);

                phantom.Position = new Vector2(325, 50);
            }
        }
Exemplo n.º 7
0
 public FileStreamResult PdfView(string viewPath, object model, Phantom phantom)
 {
     return(File(GetPdf(viewPath, model, phantom), MIME_TYPE_PDF));
 }
Exemplo n.º 8
0
 public ScoreData(int score, Phantom phantom, SceneResult.InitData.eCharaId charaId)
 {
     this.score   = score;
     this.phantom = phantom;
     this.charaId = charaId;
 }
Exemplo n.º 9
0
        public static Entity Create(this EntityType entityType, World world)
        {
            Entity entity = null;

            switch (entityType)
            {
            case EntityType.None:
                return(null);

            case EntityType.Chicken:
                entity = new Chicken(world);
                break;

            case EntityType.Cow:
                entity = new Cow(world);
                break;

            case EntityType.Pig:
                entity = new Pig(world);
                break;

            case EntityType.Sheep:
                entity = new Sheep(world);
                break;

            case EntityType.Wolf:
                entity = new Wolf(world);
                break;

            case EntityType.Villager:
                entity = new Villager(world);
                break;

            case EntityType.MushroomCow:
                entity = new Mooshroom(world);
                break;

            case EntityType.Squid:
                entity = new Squid(world);
                break;

            case EntityType.Rabbit:
                entity = new Rabbit(world);
                break;

            case EntityType.Bat:
                entity = new Bat(world);
                break;

            case EntityType.IronGolem:
                entity = new VillagerGolem(world);
                break;

            case EntityType.SnowGolem:
                entity = new Snowman(world);
                break;

            case EntityType.Ocelot:
                entity = new Ocelot(world);
                break;

            case EntityType.Zombie:
                entity = new Zombie(world);
                break;

            case EntityType.Creeper:
                entity = new Creeper(world);
                break;

            case EntityType.Skeleton:
                entity = new Skeleton(world);
                break;

            case EntityType.Spider:
                entity = new Spider(world);
                break;

            case EntityType.ZombiePigman:
                entity = new ZombiePigman(world);
                break;

            case EntityType.Slime:
                entity = new Slime(world);
                break;

            case EntityType.Endermite:
                entity = new Endermite(world);
                break;

            case EntityType.Enderman:
                entity = new Enderman(world);
                break;

            case EntityType.Silverfish:
                entity = new Silverfish(world);
                break;

            case EntityType.CaveSpider:
                entity = new CaveSpider(world);
                break;

            case EntityType.Ghast:
                entity = new Ghast(world);
                break;

            case EntityType.MagmaCube:
                entity = new MagmaCube(world);
                break;

            case EntityType.Blaze:
                entity = new Blaze(world);
                break;

            case EntityType.ZombieVillager:
                entity = new ZombieVillager(world);
                break;

            case EntityType.Witch:
                entity = new Witch(world);
                break;

            case EntityType.Stray:
                entity = new Stray(world);
                break;

            case EntityType.Husk:
                entity = new Husk(world);
                break;

            case EntityType.WitherSkeleton:
                entity = new WitherSkeleton(world);
                break;

            case EntityType.Guardian:
                entity = new Guardian(world);
                break;

            case EntityType.ElderGuardian:
                entity = new ElderGuardian(world);
                break;

            case EntityType.Horse:
                entity = new Horse(world);
                break;

            case EntityType.ZombieHorse:
                entity = new ZombieHorse(world);
                break;

            case EntityType.PolarBear:
                entity = new PolarBear(world);
                break;

            case EntityType.Shulker:
                entity = new Shulker(world);
                break;

            case EntityType.EnderDragon:
                entity = new EnderDragon(world);
                break;

            case EntityType.SkeletonHorse:
                entity = new SkeletonHorse(world);
                break;

            case EntityType.Wither:
                entity = new Wither(world);
                break;

            case EntityType.Evoker:
                entity = new EvocationIllager(world);
                break;

            case EntityType.Vindicator:
                entity = new VindicationIllager(world);
                break;

            case EntityType.Vex:
                entity = new Vex(world);
                break;

            case EntityType.FallingBlock:
                entity = new EntityFallingBlock(world);
                break;

            case EntityType.ArmorStand:
                entity = new EntityArmorStand(world, null);
                break;

            case EntityType.Arrow:
                entity = new ArrowEntity(world, null);
                break;

            case EntityType.Item:
                entity = new ItemEntity(world);
                break;

            case EntityType.Mooshroom:
                entity = new Mooshroom(world);
                break;

            case EntityType.Snowball:
                entity = new SnowballEntity(world, null);
                break;

            case EntityType.ThrownEgg:
                entity = new EggEntity(world, null);

                break;

            case EntityType.Donkey:
                entity = new Donkey(world);
                break;

            case EntityType.Llama:
                entity = new Llama(world);
                break;

            case EntityType.Mule:
                entity = new Mule(world);
                break;

            case EntityType.Fox:
                entity = new Fox(world);
                break;

            case EntityType.Parrot:
                entity = new Parrot(world);
                break;

            case EntityType.Phantom:
                entity = new Phantom(world);
                break;

            case EntityType.Bee:
                entity = new Bee(world);
                break;

            case EntityType.LlamaSpit:
                entity = new LlamaSpit(world);
                break;

            case EntityType.Cat:
                entity = new Cat(world);
                break;

            case EntityType.SmallFireball:
                entity = new SmallFireball(world);
                break;

            case EntityType.Fireball:
                entity = new Fireball(world);
                break;

            case EntityType.Dolphin:
                entity = new Dolphin(world);
                break;

            case EntityType.Cod:
                entity = new Cod(world);
                break;

            case EntityType.PufferFish:
                entity = new PufferFish(world);
                break;

            case EntityType.Salmon:
                entity = new Salmon(world);
                break;

            case EntityType.TropicalFish:
                entity = new TropicalFish(world);
                break;

            case EntityType.FireworkRocket:
                entity = new FireworkRocket(world, null);
                break;

            //case EntityType.Human:
            //entity = new PlayerMob("test", world, );
            //	break;
            default:
                return(null);
            }

            return(entity);
        }
Exemplo n.º 10
0
    /// <summary>
    /// Output phantom group.
    /// </summary>
    /// <param name="w">StreamWriter</param>
    /// <param name="index">Index into phantoms list</param>
    /// <param name="phantoms">Phantoms list</param>
    private void OutputText(StreamWriter w, int index, ArrayList phantoms)
    {
        w.WriteLine("Phantom Group " + (index + 1));
        Phantom pht = (Phantom)phantoms[0];

        w.WriteLine();
        w.WriteLine("  Stacksize:               " + pht.tStack);
        w.WriteLine("  Model (C/M/N/D):         " + pht.tCpu + " / " + pht.tMem + " / " + pht.tNet + " / " + pht.tDsk);

        if (pht.pRes == null)
        {
            w.WriteLine("  Reservation (C/M/N/D):   - / - / - / -");
        }
        else
        {
            w.WriteLine("  Reservation (C/M/N/D):   " + ((pht.pRes.c == null) ? "-" : pht.pRes.c) + " / " + ((pht.pRes.m == null) ? "-" : pht.pRes.m) + " / " + ((pht.pRes.n == null) ? "-" : pht.pRes.n) + " / " + ((pht.pRes.d == null) ? "-" : pht.pRes.d));
        }

        w.WriteLine("  Real (C/M/N/D):          " + pht.lCpu + " / " + pht.lMem + " / " + pht.lNet + " / " + pht.lDsk);

        Server srv;

        w.WriteLine();
        for (int pIdx = 0; pIdx < phantoms.Count; pIdx++)
        {
            pht = (Phantom)phantoms[pIdx];
            w.WriteLine("  [" + pht.name + "]");
            for (int sIdx = 0; sIdx < pht.srvs.Count; sIdx++)
            {
                srv = (Server)pht.srvs.GetByIndex(sIdx);
                w.WriteLine("        " + srv.name + "   " + srv.cpu + " / " + srv.mem + " / " + srv.net + " / " + srv.dsk);
            }
            w.WriteLine("    Usage:     " + pht.cpu + " / " + pht.mem + " / " + pht.net + " / " + pht.dsk);
            w.Write("    Remaining: ");
            if (pht.tCpu > 0)
            {
                w.Write((pht.tCpu - pht.cpu) + " / ");
            }
            else
            {
                w.Write("- /");
            }

            if (pht.tMem > 0)
            {
                w.Write((pht.tMem - pht.mem) + " / ");
            }
            else
            {
                w.Write("- / ");
            }

            if (pht.tNet > 0)
            {
                w.Write((pht.tNet - pht.net) + " / ");
            }
            else
            {
                w.Write("- / ");
            }

            if (pht.tDsk > 0)
            {
                w.WriteLine(pht.tDsk - pht.dsk);
            }
            else
            {
                w.WriteLine("-");
            }
            w.WriteLine();
        }
    }
Exemplo n.º 11
0
 public ChildProcess(Phantom phantom)
 {
     this.phantom = phantom;
 }
Exemplo n.º 12
0
 private int RegisterPhantom(Phantom n)
 {
     phantomList.AddLast(n);
     return(phantomList.Count);
 }
Exemplo n.º 13
0
    /// <summary>
    /// Create map and tables.
    /// </summary>
    /// <param name="w">StreamWriter</param>
    /// <param name="index">Phantom index</param>
    /// <param name="phantoms">Phantoms list</param>
    private void CreateHtml(StreamWriter w, int index, ArrayList phantoms)
    {
        Rectangle rct;
        string    s;

        w.WriteLine("<MAP NAME=\"scenario" + index + "\">");

        for (int i = 0; i < mapDecl.Count; i++)
        {
            rct = (Rectangle)mapDecl.GetByIndex(i);
            s   = (string)mapDecl.GetKey(i);

            w.WriteLine("<AREA SHAPE=\"RECT\" COORDS=\"" + rct.X + "," + rct.Y + "," + (rct.Width + rct.X) + "," + (rct.Height + rct.Y) + "\" ALT=\"" + s + "\" HREF=\"#" + s + "\" onMouseOver=\"Show('" + s + "', event)\" onMouseOut=\"Hide()\">");
        }

        w.WriteLine("</MAP>");
        w.WriteLine("<P><DIV CLASS=\"group\"><A NAME=\"phg" + index + "\"></A><H3>Phantom Group " + (index + 1) + "</H3>");
        Phantom pht = (Phantom)phantoms[0];

        w.WriteLine("<P><DIV CLASS=\"groupleft\">");
        w.WriteLine("<TABLE>");
        w.WriteLine("<TR><TH></TH><TH>Cpu</TH><TH>Mem</TH><TH>Net</TH><TH>Dsk</TH></TR>");
        w.WriteLine("<TR><TH>Model</TH><TD>" + pht.tCpu + "</TD><TD>" + pht.tMem + "</TD><TD>" + pht.tNet + "</TD><TD>" + pht.tDsk + "</TD></TR>");

        if (pht.pRes == null)
        {
            w.WriteLine("<TR><TH>Reservation</TH><TD>-</TD><TD>-</TD><TD>-</TD><TD>-</TD></TR>");
        }
        else
        {
            w.WriteLine("<TR><TH>Reservation</TH><TD>" + ((pht.pRes.c == null) ? "-" : pht.pRes.c) + "</TD><TD>" + ((pht.pRes.m == null) ? "-" : pht.pRes.m) + "</TD><TD>" + ((pht.pRes.n == null) ? "-" : pht.pRes.n) + "</TD><TD>" + ((pht.pRes.d == null) ? "-" : pht.pRes.d) + "</TD></TR>");
        }

        w.WriteLine("<TR><TH>Real</TH><TD>" + pht.lCpu + "</TD><TD>" + pht.lMem + "</TD><TD>" + pht.lNet + "</TD><TD>" + pht.lDsk + "</TD></TR>");
        w.WriteLine("</TABLE>");
        w.WriteLine("</DIV><DIV CLASS=\"groupmiddle\">");
        w.WriteLine("<TABLE><TR><TH>Stacksize</TH></TR>");
        w.WriteLine("<TR><TD>" + pht.tStack + "</TD></TR>");
        w.WriteLine("</TABLE>");

        w.WriteLine("</DIV><DIV CLASS=\"groupright\">");
        w.WriteLine("<TABLE><TR><TH>Distribution</TH></TR>");
        w.WriteLine("<TR><TD><IMG SRC=\"image" + index + ".gif\" WIDTH=\"" + imgW + "\" HEIGHT=\"" + imgH + "\" ALT=\"Server distribution\" ISMAP USEMAP=\"#scenario" + index + "\" STYLE=\"border: none\"></TD></TR>");
        w.WriteLine("</TABLE>");
        w.WriteLine("</DIV>");

        Server srv;

        for (int pIdx = 0; pIdx < phantoms.Count; pIdx++)
        {
            pht = (Phantom)phantoms[pIdx];
            w.WriteLine("<DIV CLASS=\"groupphantoms\"><TABLE>");
            w.WriteLine("<CAPTION>" + HttpUtility.HtmlEncode(pht.name) + "</CAPTION>");
            w.WriteLine("<TR><TH>Server name</TH><TH>Cpu</TH><TH>Mem</TH><TH>Net</TH><TH>Dsk</TH></TR>");
            for (int sIdx = 0; sIdx < pht.srvs.Count; sIdx++)
            {
                srv = (Server)pht.srvs.GetByIndex(sIdx);
                w.WriteLine("<TR><TD><A NAME=\"" + HttpUtility.HtmlEncode(srv.name) + "\">" + HttpUtility.HtmlEncode(srv.name) + "</A></TD><TD>" + srv.cpu + "</TD><TD>" + srv.mem + "</TD><TD>" + srv.net + "</TD><TD>" + srv.dsk + "</TD></TR>");
            }
            w.WriteLine("<TR><TH>Usage:</TH><TD><B>" + pht.cpu + "</B></TD><TD><B>" + pht.mem + "</B></TD><TD><B>" + pht.net + "</B></TD><TD><B>" + pht.dsk + "</B></TD></TR>");
            w.WriteLine("<TR><TD>Remaining:</TD>");
            if (pht.tCpu > 0)
            {
                w.WriteLine("<TD>" + (pht.tCpu - pht.cpu) + "</TD>");
            }
            else
            {
                w.WriteLine("<TD>-</TD>");
            }

            if (pht.tMem > 0)
            {
                w.WriteLine("<TD>" + (pht.tMem - pht.mem) + "</TD>");
            }
            else
            {
                w.WriteLine("<TD>-</TD>");
            }

            if (pht.tNet > 0)
            {
                w.WriteLine("<TD>" + (pht.tNet - pht.net) + "</TD>");
            }
            else
            {
                w.WriteLine("<TD>-</TD>");
            }

            if (pht.tDsk > 0)
            {
                w.WriteLine("<TD>" + (pht.tDsk - pht.dsk) + "</TD>");
            }
            else
            {
                w.WriteLine("<TD>-</TD>");
            }

            w.WriteLine("</TABLE></DIV>");
        }
        w.WriteLine("</DIV><P><BR>");
    }
Exemplo n.º 14
0
    void Start()
    {
        // デバッグ用
        if (initDatas == null)
        {
            initDatas = new List <InitData>();
            initDatas.Add(new InitData(InitData.eCharaId.Detective, 0));
            initDatas.Add(new InitData(InitData.eCharaId.Phantom0, 1));
            initDatas.Add(new InitData(InitData.eCharaId.Phantom1, 2));
            initDatas.Add(new InitData(InitData.eCharaId.Phantom2, 3));
        }

        // 座標取得
        var pointTrans = GameObject.Find("Points").transform;

        // お宝の座標
        m_TresurePosDatas    = new TresurePosDataBase[4];
        m_TresurePosDatas[0] = new TresurePosDataBase(pointTrans.Find("ItemRespawnPoints/P1").position);
        m_TresurePosDatas[1] = new TresurePosDataBase(pointTrans.Find("ItemRespawnPoints/P2").position);
        m_TresurePosDatas[2] = new TresurePosDataBase(pointTrans.Find("ItemRespawnPoints/P3").position);
        m_TresurePosDatas[3] = new TresurePosDataBase(pointTrans.Find("ItemRespawnPoints/P4").position);
        // 怪盗リスポーン座標
        m_phantomRespawnPosDatas    = new Vector3[4];
        m_phantomRespawnPosDatas[0] = pointTrans.Find("PhantomRespawnPoints (1)/P1").position;
        m_phantomRespawnPosDatas[1] = pointTrans.Find("PhantomRespawnPoints (1)/P2").position;
        m_phantomRespawnPosDatas[2] = pointTrans.Find("PhantomRespawnPoints (1)/P3").position;
        m_phantomRespawnPosDatas[3] = pointTrans.Find("PhantomRespawnPoints (1)/P4").position;
        // 探偵の座標
        m_detectivePosData = pointTrans.Find("DetectiveRespawnPoints (2)/P1").position;

        // 全体のお宝
        m_stockTreasures.Add(new TreasureData(eTreasureType.Ring));
        m_stockTreasures.Add(new TreasureData(eTreasureType.Ring));
        m_stockTreasures.Add(new TreasureData(eTreasureType.Ring));
        m_stockTreasures.Add(new TreasureData(eTreasureType.Bracelet));
        m_stockTreasures.Add(new TreasureData(eTreasureType.Bracelet));
        m_stockTreasures.Add(new TreasureData(eTreasureType.Crown));
        m_treasureMaxAll = m_stockTreasures.Count;

        m_treasureNumText = GameObject.Find("TreasureNum").GetComponent <Text>();
        m_treasureNumText.gameObject.SetActive(false);
        m_moonBeginTransform = GameObject.Find("MoonBegin").GetComponent <RectTransform>();
        m_moonEndTransform   = GameObject.Find("MoonEnd").GetComponent <RectTransform>();
        m_moonTransform      = GameObject.Find("moon").GetComponent <RectTransform>();
        m_moonTransform.gameObject.SetActive(false);
        m_timeText = GameObject.Find("timeText").GetComponent <Text>();

        UpdateTreasureNumText();

        for (int i = 0; i < initDatas.Count; i++)
        {
            if (initDatas[i].charaId == InitData.eCharaId.None)
            {
                continue;
            }
            string  path = "";
            Vector3 pos  = Vector3.zero;
            switch (initDatas[i].charaId)
            {
            case InitData.eCharaId.Detective:
                path = "Prefabs/Character/Detective";
                pos  = m_detectivePosData;
                break;

            case InitData.eCharaId.Phantom0:
                path = "Prefabs/Character/Phantom";
                pos  = m_phantomRespawnPosDatas[0];
                break;

            case InitData.eCharaId.Phantom1:
                path = "Prefabs/Character/Phantom2";
                pos  = m_phantomRespawnPosDatas[1];
                break;

            case InitData.eCharaId.Phantom2:
                path = "Prefabs/Character/Phantom3";
                pos  = m_phantomRespawnPosDatas[2];
                break;
            }
            var obj = Instantiate(Resources.Load(path)) as GameObject;
            obj.transform.position = pos;
            switch (initDatas[i].charaId)
            {
            case InitData.eCharaId.Detective:
                m_detective = obj.GetComponent <Detective>();
                m_detective.Init(initDatas[i]);
                break;

            case InitData.eCharaId.Phantom0:
                m_phantom1 = obj.GetComponent <Phantom>();
                m_phantom1.Init(initDatas[i]);
                break;

            case InitData.eCharaId.Phantom1:
                m_phantom2 = obj.GetComponent <Phantom>();
                m_phantom2.Init(initDatas[i]);
                break;

            case InitData.eCharaId.Phantom2:
                m_phantom3 = obj.GetComponent <Phantom>();
                m_phantom3.Init(initDatas[i]);
                break;
            }
        }
        //Instantiate(Resources.Load("Prefabs/Stage/Stage00"));
        CreateTresure();

        FadeManager.TipsOn();
    }
Exemplo n.º 15
0
        public Character GetEnemy(int id)
        {
            Character nextChar;

            switch (id)
            {
            //Low level
            case 100:
                nextChar = new Bat();
                return(nextChar);

            case 101:
                nextChar = new Rat();
                return(nextChar);

            case 102:
                nextChar = new Kobold();
                return(nextChar);

            case 103:
                nextChar = new Slime();
                return(nextChar);

            case 104:
                nextChar = new Farmer();
                return(nextChar);

            case 105:
                nextChar = new Imp();
                return(nextChar);

            case 106:
                nextChar = new Zombie();
                return(nextChar);

            case 107:
                nextChar = new Phantom();
                return(nextChar);

            case 108:
                nextChar = new Goblin();
                return(nextChar);

            case 109:
                nextChar = new Witch();
                return(nextChar);

            //Mid level
            case 110:
                nextChar = new Harpy();
                return(nextChar);

            case 111:
                nextChar = new Elemental();
                return(nextChar);

            case 112:
                nextChar = new Nymph();
                return(nextChar);

            case 113:
                nextChar = new Vampire();
                return(nextChar);

            case 114:
                nextChar = new Lamia();
                return(nextChar);

            case 115:
                nextChar = new Qilin();
                return(nextChar);

            case 116:
                nextChar = new Unicorn();
                return(nextChar);

            case 117:
                nextChar = new Jinn();
                return(nextChar);

            case 118:
                nextChar = new Xorn();
                return(nextChar);

            case 119:
                nextChar = new Antlion();
                return(nextChar);

            //High level
            case 120:
                nextChar = new Yeti();
                return(nextChar);

            case 121:
                nextChar = new Orc();
                return(nextChar);

            case 122:
                nextChar = new Minotaur();
                return(nextChar);

            case 123:
                nextChar = new Troll();
                return(nextChar);

            case 124:
                nextChar = new Cyclop();
                return(nextChar);

            case 125:
                nextChar = new Drake();
                return(nextChar);

            default:
                nextChar = new Slime();
                return(nextChar);
            }
        }
Exemplo n.º 16
0
        public static void OpenCoffin(Mobile from, int item, int level)
        {
            if (Utility.RandomMinMax(1, 10) == 1)                 // 10% CHANCE FOR RAISING DEAD IN COFFINS
            {
                if (item == 0x2800 || item == 0x2801 || item == 0x27E9 || item == 0x27EA || item == 0x27E0 || item == 0x280A || item == 0x2802 || item == 0x2803)
                {
                    int seance = (int)(from.Skills[SkillName.SpiritSpeak].Value);

                    if (!Server.Misc.GetPlayerInfo.LuckyPlayer(from.Luck) && Utility.RandomMinMax(1, 100) > seance)
                    {
                        if (level > 6)
                        {
                            level = 6;
                        }
                        level = level * 3;

                        from.RevealingAction();

                        BaseCreature spawned = new Zombie();

                        switch (Utility.Random(level))
                        {
                        case 0: spawned = new Skeleton(); break;

                        case 1: spawned = new Zombie(); break;

                        case 2: spawned = new Ghoul(); break;

                        case 3: spawned = new Shade(); break;

                        case 4: spawned = new Spectre(); break;

                        case 5: spawned = new Wraith(); break;

                        case 6: spawned = new Phantom(); break;

                        case 7: spawned = new SkeletalWizard(); break;

                        case 8: spawned = new BoneKnight(); break;

                        case 9: spawned = new BoneMagi(); break;

                        case 10: spawned = new SkeletalKnight(); break;

                        case 11: spawned = new SkeletalMage(); break;

                        case 12: spawned = new Mummy(); break;

                        case 13: spawned = new Vampire(); break;

                        case 14: spawned = new Ghostly(); break;

                        case 15: spawned = new Lich(); break;

                        case 16: spawned = new LichLord(); break;

                        case 17: spawned = new RottingCorpse(); break;
                        }

                        string sSaying = "";
                        switch (Utility.Random(9))
                        {
                        case 0: sSaying = "Who has disturbed me!"; break;

                        case 1: sSaying = "You dare steal from my grave?"; break;

                        case 2: sSaying = "Those that take from me will join me!"; break;

                        case 3: sSaying = "Your soul is now mine for the taking!"; break;

                        case 4: sSaying = "Who dares waken me?"; break;

                        case 5: sSaying = "Your life will be extinguished!"; break;

                        case 6: sSaying = "Do you have no respect for the dead?"; break;

                        case 7: sSaying = "I have been waiting to feast off the living!"; break;

                        case 8: sSaying = "Soon you will join my legion of the dead!"; break;
                        }

                        spawned.OnBeforeSpawn(from.Location, from.Map);
                        spawned.Home      = from.Location;
                        spawned.RangeHome = 5;
                        spawned.Title    += " [Awakened]";
                        spawned.MoveToWorld(from.Location, from.Map);
                        spawned.Say(sSaying);
                        spawned.ControlSlots = 666;
                        spawned.Combatant    = from;
                    }
                }
            }
        }
Exemplo n.º 17
0
 public void OnUpdate(Phantom arg_phantom)
 {
 }
Exemplo n.º 18
0
 public void OnExit(Phantom arg_phantom)
 {
 }
Exemplo n.º 19
0
 public void OnEnter(Phantom arg_phantom)
 {
     arg_phantom.gameObject.SetActive(false);
 }
Exemplo n.º 20
0
        public override void OnHarvestFinished(Mobile from, Item tool, HarvestDefinition def, HarvestVein vein, HarvestBank bank, HarvestResource resource, object harvested)
        {
            Map     map = from.Map;
            Point3D loc = from.Location;

            HarvestResource res = vein.PrimaryResource;

            if (res == resource)
            {
                try
                {
                    if (from.Karma > -2459)
                    {
                        Titles.AwardKarma(from, -50, true);
                    }

                    if (Utility.RandomMinMax(1, 100) < 3)                         // CHECK TO SEE IF THEY WERE WITNESSED DIGGING UP A GRAVE 2%
                    {
                        int caught = 1;
                        if (from.Skills[SkillName.Hiding].Value >= 30)
                        {
                            from.SendMessage("Someone passed by, but your stealthiness has avoided you from being seen.");
                            if (from.CheckSkill(SkillName.Stealth, 0, 100))
                            {
                                caught = 0;
                            }
                        }
                        if (caught > 0)
                        {
                            from.PrivateOverheadMessage(MessageType.Regular, 1150, false, "Someone has spotted you in the distance!", from.NetState);
                            from.SendMessage("You have been reported as a criminal!");
                            from.Criminal = true;
                            Server.Items.DisguiseTimers.RemoveDisguise(from);
                        }
                    }

                    map = from.Map;

                    if (map == null)
                    {
                        return;
                    }

                    BaseCreature spawned = new Zombie();

                    switch (Utility.Random(19))
                    {
                    case 0: spawned = new Zombie(); break;

                    case 1: spawned = new Skeleton(); break;

                    case 2: spawned = new Ghoul(); break;

                    case 3: spawned = new Shade(); break;

                    case 4: spawned = new Spectre(); break;

                    case 5: spawned = new Wraith(); break;

                    case 6: spawned = new BoneKnight(); break;

                    case 7: spawned = new BoneMagi(); break;

                    case 8: spawned = new Ghostly(); break;

                    case 9: spawned = new Lich(); break;

                    case 10: spawned = new LichLord(); break;

                    case 11: spawned = new Mummy(); break;

                    case 12: spawned = new RottingCorpse(); break;

                    case 13: spawned = new Shade(); break;

                    case 14: spawned = new SkeletalKnight(); break;

                    case 15: spawned = new SkeletalWizard(); break;

                    case 16: spawned = new SkeletalMage(); break;

                    case 17: spawned = new Phantom(); break;

                    case 18: spawned = new Vampire(); break;
                    }

                    int nSpiritSpeak = (int)(from.Skills[SkillName.SpiritSpeak].Value / 10);

                    string sSaying = "";
                    switch (Utility.Random(9))
                    {
                    case 0: sSaying = "Who has disturbed me!"; break;

                    case 1: sSaying = "You dare steal from my grave?"; break;

                    case 2: sSaying = "Those that take from me will join me!"; break;

                    case 3: sSaying = "Your soul is now mine for the taking!"; break;

                    case 4: sSaying = "Who dares waken me?"; break;

                    case 5: sSaying = "Your life will be extinguished!"; break;

                    case 6: sSaying = "Do you have no respect for the dead?"; break;

                    case 7: sSaying = "I have been waiting to feast off the living!"; break;

                    case 8: sSaying = "Soon you will join my legion of the dead!"; break;
                    }

                    if ((spawned != null) && (Utility.Random(100) > (nSpiritSpeak + 85)))                             // 10% chance you will get a grave raiser
                    {
                        from.CheckSkill(SkillName.SpiritSpeak, 0, 100);
                        int offset = Utility.Random(8) * 2;

                        for (int i = 0; i < m_Offsets.Length; i += 2)
                        {
                            int x = from.X + m_Offsets[(offset + i) % m_Offsets.Length];
                            int y = from.Y + m_Offsets[(offset + i + 1) % m_Offsets.Length];

                            if (map.CanSpawnMobile(x, y, from.Z))
                            {
                                spawned.OnBeforeSpawn(new Point3D(x, y, from.Z), map);
                                spawned.Home      = new Point3D(x, y, from.Z);
                                spawned.RangeHome = 5;
                                spawned.Title    += " [Awakened]";
                                spawned.MoveToWorld(new Point3D(x, y, from.Z), map);
                                spawned.Say(sSaying);
                                spawned.ControlSlots = 666;
                                spawned.Combatant    = from;
                                return;
                            }
                            else
                            {
                                int z = map.GetAverageZ(x, y);

                                if (map.CanSpawnMobile(x, y, z))
                                {
                                    spawned.OnBeforeSpawn(new Point3D(x, y, z), map);
                                    spawned.Home      = new Point3D(x, y, z);
                                    spawned.RangeHome = 5;
                                    spawned.Title    += " [Awakened]";
                                    spawned.MoveToWorld(new Point3D(x, y, z), map);
                                    spawned.Say(sSaying);
                                    spawned.ControlSlots = 666;
                                    spawned.Combatant    = from;
                                    return;
                                }
                            }
                        }
                        spawned.OnBeforeSpawn(from.Location, from.Map);
                        spawned.Home      = from.Location;
                        spawned.RangeHome = 5;
                        spawned.Title    += " [Awakened]";
                        spawned.MoveToWorld(from.Location, from.Map);
                        spawned.Say(sSaying);
                        spawned.ControlSlots = 666;
                        spawned.Combatant    = from;
                    }

                    int digger = (int)(from.Skills[SkillName.Forensics].Value / 10);
                    if ((2 + digger) > Utility.Random(100))                       // chance to dig up a box
                    {
                        if (from.CheckSkill(SkillName.Forensics, 0, 125))
                        {
                            Item chest = new GraveChest(6, from);
                            switch (Utility.Random(10 + digger))
                            {
                            case 0: chest = new GraveChest(1, from); break;

                            case 1: chest = new GraveChest(1, from); break;

                            case 2: chest = new GraveChest(1, from); break;

                            case 3: chest = new GraveChest(1, from); break;

                            case 4: chest = new GraveChest(1, from); break;

                            case 5: chest = new GraveChest(1, from); break;

                            case 6: chest = new GraveChest(2, from); break;

                            case 7: chest = new GraveChest(2, from); break;

                            case 8: chest = new GraveChest(2, from); break;

                            case 9: chest = new GraveChest(2, from); break;

                            case 10: chest = new GraveChest(2, from); break;

                            case 11: chest = new GraveChest(3, from); break;

                            case 12: chest = new GraveChest(3, from); break;

                            case 13: chest = new GraveChest(3, from); break;

                            case 14: chest = new GraveChest(3, from); break;

                            case 15: chest = new GraveChest(4, from); break;

                            case 16: chest = new GraveChest(4, from); break;

                            case 17: chest = new GraveChest(4, from); break;

                            case 18: chest = new GraveChest(5, from); break;

                            case 19: chest = new GraveChest(5, from); break;
                            }
                            if (chest != null)
                            {
                                chest.MoveToWorld(loc, map);
                                from.SendMessage("you dig up a graveyard chest.");
                            }
                        }
                    }
                }
                catch
                {
                }
            }
        }
Exemplo n.º 21
0
        public override void Render(Phantom.Graphics.RenderInfo info)
        {
            info.Canvas.FillColor = Focused ? GUISettings.ColorTextField : GUISettings.ColorHighLight;
            info.Canvas.StrokeColor = GUISettings.ColorShadow;
            info.Canvas.LineWidth = 2;
            Vector2 position = new Vector2(RealLeft, RealTop);
            Vector2 halfSize = new Vector2(Width * 0.5f, Height * 0.5f);
            info.Canvas.StrokeRect(position + halfSize, halfSize, 0);
            info.Canvas.FillRect(position + halfSize, halfSize, 0);

            Vector2 size = GUISettings.Font.MeasureString(Caption);
            Vector2 pos = position + CaptionPosition;
            pos.Y += halfSize.Y-size.Y*0.5f;
            info.Batch.DrawString(GUISettings.Font, Caption, pos, GUISettings.ColorText);
            size = GUISettings.Font.MeasureString(Text);
            pos = position;
            pos.Y += halfSize.Y-size.Y*0.5f;
            pos.X += 5;
            info.Batch.DrawString(GUISettings.Font, Text, pos, GUISettings.ColorText);

            if (Focused && cursorClock % 0.5f < 0.25f)
            {
                pos.Y += size.Y*0.5f;
                size = GUISettings.Font.MeasureString(Text.Substring(0, cursor));
                pos.X += size.X;
                halfSize.X = 0;
                halfSize.Y *= 0.8f;
                info.Canvas.LineWidth = 1;
                info.Canvas.StrokeLine(pos - halfSize, pos + halfSize);
            }
            base.Render(info);
        }