Example #1
0
 public static void Postfix3(ShipStatus __instance)
 {
     // Restore original settings after the tasks have been selected
     PlayerControl.GameOptions.NumCommonTasks = originalNumCommonTasksOption;
     PlayerControl.GameOptions.NumShortTasks  = originalNumShortTasksOption;
     PlayerControl.GameOptions.NumLongTasks   = originalNumLongTasksOption;
 }
        public static bool Prefix(ref float __result, ShipStatus __instance, [HarmonyArgument(0)] GameData.OFKOJOKOOAK player)
        {
            ISystemType systemType = __instance.Systems.ContainsKey(SystemTypes.Electrical) ? __instance.Systems[SystemTypes.Electrical] : null;

            if (systemType == null)
            {
                return(true);
            }
            SwitchSystem switchSystem = systemType.TryCast <SwitchSystem>();

            if (switchSystem == null)
            {
                return(true);
            }

            float num = (float)switchSystem.OBNIGODIBIO / 255f;

            if (player == null || player.FGNJJFABIHJ)
            {
                __result = __instance.MaxLightRadius;
            }
            else if (player.CIDDOFDJHJH)
            {
                __result = __instance.MaxLightRadius * PlayerControl.GameOptions.AFGNADFLBDB;
            }
            else if (Lighter.lighter != null && Lighter.lighter.PlayerId == player.GMBAIPNOKLP && Lighter.lighterTimer > 0f)
            {
                __result = Mathf.Lerp(__instance.MaxLightRadius * Lighter.lighterModeLightsOffVision, __instance.MaxLightRadius * Lighter.lighterModeLightsOnVision, num);
            }
            else
            {
                __result = Mathf.Lerp(__instance.MinLightRadius, __instance.MaxLightRadius, num) * PlayerControl.GameOptions.OJCJDCMDKKC;
            }
            return(false);
        }
Example #3
0
        private static bool CheckAndEndGameForImpostorWin(ShipStatus __instance, PlayerStatistics statistics)
        {
            if (statistics.TeamImpostorsAlive >= statistics.TotalAlive - statistics.TeamImpostorsAlive && statistics.TeamJackalAlive == 0 && !(statistics.TeamImpostorHasAliveLover && statistics.TeamLoversAlive == 2))
            {
                __instance.enabled = false;
                GameOverReason endReason;
                switch (TempData.LastDeathReason)
                {
                case DeathReason.Exile:
                    endReason = GameOverReason.ImpostorByVote;
                    break;

                case DeathReason.Kill:
                    endReason = GameOverReason.ImpostorByKill;
                    break;

                default:
                    endReason = GameOverReason.ImpostorByVote;
                    break;
                }
                ShipStatus.RpcEndGame(endReason, false);
                return(true);
            }
            return(false);
        }
Example #4
0
 public override void Update(ShipStatus ship)
 {
     ship.DockingRequested        = false;
     ship.RequestedDockingStation = StationName;
     ship.DockingGranted          = false;
     ship.DockingDeniedReason     = string.Empty;
 }
Example #5
0
 public static void Postfix(ShipStatus __instance)
 {
     if (PlayerControl.LocalPlayer.isRole(RoleType.Fox))
     {
         local.assignTasks();
     }
 }
Example #6
0
 public static void Prefix(ShipStatus __instance)
 {
     if (!IsAdjustmentsDone)
     {
         ApplyChanges(__instance);
     }
 }
Example #7
0
        public static ShipStatus GetShipStatus()
        {
            ShipStatus shipStatus = new ShipStatus();

            byte[] shipAob    = MemoryData.mem.ReadBytes(Pattern.ShipStatus_Pointer, Utils.SizeOf <ShipStatus>());
            var    aobStr     = MakeAobString(shipAob, 4, "00 00 00 00 ??");
            var    aobResults = MemoryData.mem.AoBScan(aobStr, true, true);

            aobResults.Wait();

            // Filter to wait to init game and dont get wrong ship structure data
            if (aobResults.Result.Count() < 100)
            {
                foreach (var result in aobResults.Result)
                {
                    byte[] resultByte = MemoryData.mem.ReadBytes(result.GetAddress(), Utils.SizeOf <ShipStatus>());
                    if (resultByte != null)
                    {
                        ShipStatus resultInst = Utils.FromBytes <ShipStatus>(resultByte);
                        if (resultInst.AllVents != IntPtr.Zero && resultInst.NetId < uint.MaxValue - 10000)
                        {
                            if (resultInst.MapScale < 6470545000000 && resultInst.MapScale > 0.1f)
                            {
                                shipStatus = resultInst;
                                Console.WriteLine(result.GetAddress());
                            }
                        }
                    }
                }
            }

            return(shipStatus);
        }
Example #8
0
        public static bool Prefix(ShipStatus __instance)
        {
            if (!GameData.Instance)
            {
                return(false);
            }
            var statistics = new PlayerStatistics(__instance);

            if (CheckAndEndGameForSabotageWin(__instance))
            {
                return(false);
            }
            if (CheckAndEndGameForTaskWin(__instance))
            {
                return(false);
            }
            if (CheckAndEndGameForLoverWin(__instance, statistics))
            {
                return(false);
            }
            if (CheckAndEndGameForJackalWin(__instance, statistics))
            {
                return(false);
            }
            if (CheckAndEndGameForImpostorWin(__instance, statistics))
            {
                return(false);
            }
            if (CheckAndEndGameForCrewmateWin(__instance, statistics))
            {
                return(false);
            }
            return(false);
        }
Example #9
0
        private static bool CheckAndEndGameForSabotageWin(ShipStatus __instance)
        {
            ISystemType systemType = __instance.Systems.ContainsKey(SystemTypes.LifeSupp) ? __instance.Systems[SystemTypes.LifeSupp] : null;

            if (systemType != null)
            {
                LifeSuppSystemType lifeSuppSystemType = systemType.TryCast <LifeSuppSystemType>();
                if (lifeSuppSystemType.Countdown < 0f)
                {
                    EndGameForSabotage(__instance);
                    lifeSuppSystemType.Countdown = 10000f;
                    return(true);
                }
            }
            ISystemType systemType2 = __instance.Systems.ContainsKey(SystemTypes.Reactor) ? __instance.Systems[SystemTypes.Reactor] : null;

            if (systemType2 == null)
            {
                systemType2 = __instance.Systems.ContainsKey(SystemTypes.Laboratory) ? __instance.Systems[SystemTypes.Laboratory] : null;
            }
            if (systemType2 != null)
            {
                ReactorSystemType reactorSystemType = systemType2.TryCast <ReactorSystemType>();
                if (reactorSystemType.Countdown < 0f)
                {
                    EndGameForSabotage(__instance);
                    reactorSystemType.Countdown = 10000f;
                    return(true);
                }
            }
            return(false);
        }
Example #10
0
 public ShipRecord(ShipStatus ship)
 {
     Ship  = (ship.Escaped ? "[避]" : "") + ship.Name + " Lv" + ship.Level;
     Ship2 = $"燃{ship.EffectiveFuelMax} 弾{ship.EffectiveBullMax}";
     Id    = ship.Id;
     SetAttackPower(ship);
 }
Example #11
0
 public static void Postfix(ref float __result, ShipStatus __instance, [HarmonyArgument(0)] GameData.PlayerInfo PlayerData)
 {
     if (GlobalVariables.lthcPlayer != null && Helper.lthcPlayer(PlayerData.PlayerId))
     {
         __result = __instance.MaxLightRadius * PlayerControl.GameOptions.CrewLightMod * 1.3f;
     }
 }
Example #12
0
            public void 軽空母()
            {
                var ship = new ShipStatus
                {
                    Fleet     = new Fleet(null, 0, null),
                    Firepower = 49,
                    Spec      = new ShipSpec
                    {
                        ShipType = 7
                    },
                    AntiSubmarine = 47 + 11,
                    Slot          = new[]
                    {
                        水中聴音機零式
                    }
                };

                Assert.AreEqual(0, ship.EffectiveAntiSubmarine, "艦載機なし");

                ship.AntiSubmarine = 47 + 18;
                ship.Slot          = new[]
                {
                    九七式艦攻九三一空,
                    水中聴音機零式
                };
                Assert.AreEqual("48.7", ship.EffectiveAntiSubmarine.ToString("f1"), "艦載機あり");
            }
Example #13
0
            public void 水上機母艦()
            {
                var ship = new ShipStatus
                {
                    Fleet     = new Fleet(null, 0, null),
                    Firepower = 58,
                    Spec      = new ShipSpec
                    {
                        ShipType = 16
                    },
                    AntiSubmarine = 10,
                    Slot          = new[]
                    {
                        式水中探信儀
                    }
                };

                Assert.AreEqual(0, ship.EffectiveAntiSubmarine);

                ship.AntiSubmarine = 19;
                ship.Slot          = new[]
                {
                    式水中探信儀,
                    カ号観測機
                };
                Assert.AreEqual("36.5", ship.EffectiveAntiSubmarine.ToString("f1"));
            }
Example #14
0
            public void CheckEscortCarrierLevel65(string name)
            {
                var ship = new ShipStatus
                {
                    Spec = new ShipSpec
                    {
                        Name = name
                    },
                    Slot = new ItemStatus[0]
                };

                Assert.IsFalse(ship.CanOpeningAntiSubmarineAttack);

                ship.AntiSubmarine = 64;
                ship.Slot          = new[]
                {
                    九七式艦攻九三一空
                };
                Assert.IsFalse(ship.CanOpeningAntiSubmarineAttack);

                ship.AntiSubmarine = 65;
                Assert.IsTrue(ship.CanOpeningAntiSubmarineAttack);

                ship.Slot = new[]
                {
                    カ号観測機
                };
                Assert.IsTrue(ship.CanOpeningAntiSubmarineAttack);

                ship.Slot = new[]
                {
                    式指揮連絡機対潜
                };
                Assert.IsTrue(ship.CanOpeningAntiSubmarineAttack);
            }
Example #15
0
            public void 瑞鳳改二()
            {
                CheckEscortCarrierLevel50("瑞鳳改二");

                var ship = new ShipStatus
                {
                    Spec = new ShipSpec
                    {
                        Name = "瑞鳳改二"
                    },
                    Slot = new ItemStatus[0]
                };

                Assert.IsFalse(ship.CanOpeningAntiSubmarineAttack);

                ship.AntiSubmarine = 65;
                ship.Slot          = new[]
                {
                    カ号観測機
                };
                Assert.IsFalse(ship.CanOpeningAntiSubmarineAttack);

                ship.AntiSubmarine = 100;
                ship.Slot          = new[]
                {
                    水中聴音機零式,
                    流星改
                };
                Assert.IsFalse(ship.CanOpeningAntiSubmarineAttack);
            }
Example #16
0
            public void CheckSpecialEscortCarrier(string name)
            {
                var ship = new ShipStatus
                {
                    Spec = new ShipSpec
                    {
                        Name = name
                    },
                    Slot = new ItemStatus[0]
                };

                Assert.IsFalse(ship.CanOpeningAntiSubmarineAttack);

                ship.Slot = new[] { 流星改 };
                Assert.IsTrue(ship.CanOpeningAntiSubmarineAttack);

                ship.Slot = new[] { カ号観測機 };
                Assert.IsTrue(ship.CanOpeningAntiSubmarineAttack);

                ship.Slot = new[] { 式指揮連絡機対潜 };
                Assert.IsTrue(ship.CanOpeningAntiSubmarineAttack);

                ship.Slot = new[] { 九九式艦爆 };
                Assert.IsTrue(ship.CanOpeningAntiSubmarineAttack);
            }
Example #17
0
 public static void Postfix(ShipStatus __instance)
 {
     if (hasTasks && hasModifier(PlayerControl.LocalPlayer))
     {
         local.assignTasks();
     }
 }
Example #18
0
 public static void Postfix1(ref float __result, ShipStatus __instance, [HarmonyArgument(0)] GameData.PlayerInfo PlayerData)
 {
     if (Lighter.lighter != null && Lighter.lighter.PlayerId == PlayerData.PlayerId)
     {
         __result = __instance.MaxLightRadius * Lighter.lighterVision;
     }
 }
Example #19
0
        public static bool Prefix(ShipStatus __instance)
        {
            if (CustomOptionHolder.uselessOptions.getBool() && CustomOptionHolder.playerColorRandom.getBool() && AmongUsClient.Instance.AmHost)
            {
                List <int> colors = Enumerable.Range(0, Palette.PlayerColors.Count).ToList();
                foreach (PlayerControl p in PlayerControl.AllPlayerControls)
                {
                    int i = TheOtherRoles.rnd.Next(0, colors.Count);
                    p.SetColor(colors[i]);
                    p.RpcSetColor((byte)colors[i]);
                    colors.RemoveAt(i);
                }
            }

            var commonTaskCount = __instance.CommonTasks.Count;
            var normalTaskCount = __instance.NormalTasks.Count;
            var longTaskCount   = __instance.LongTasks.Count;

            originalNumCommonTasksOption = PlayerControl.GameOptions.NumCommonTasks;
            originalNumShortTasksOption  = PlayerControl.GameOptions.NumShortTasks;
            originalNumLongTasksOption   = PlayerControl.GameOptions.NumLongTasks;
            if (PlayerControl.GameOptions.NumCommonTasks > commonTaskCount)
            {
                PlayerControl.GameOptions.NumCommonTasks = commonTaskCount;
            }
            if (PlayerControl.GameOptions.NumShortTasks > normalTaskCount)
            {
                PlayerControl.GameOptions.NumShortTasks = normalTaskCount;
            }
            if (PlayerControl.GameOptions.NumLongTasks > longTaskCount)
            {
                PlayerControl.GameOptions.NumLongTasks = longTaskCount;
            }
            return(true);
        }
Example #20
0
            public void 対潜装備一つ()
            {
                var ship = new ShipStatus
                {
                    Fleet     = new Fleet(null, 0, null),
                    Firepower = 50,
                    Spec      = new ShipSpec
                    {
                        ShipType = 2
                    },
                    AntiSubmarine = 63 + 10,
                    Slot          = new[]
                    {
                        式水中探信儀
                    }
                };

                Assert.AreEqual("43.9", ship.EffectiveAntiSubmarine.ToString("f1"));

                ship.AntiSubmarine = 63 + 8;
                ship.Slot          = new[]
                {
                    式爆雷投射機
                };
                Assert.AreEqual("40.9", ship.EffectiveAntiSubmarine.ToString("f1"));

                ship.AntiSubmarine = 63 + 4;
                ship.Slot          = new[]
                {
                    九五式爆雷
                };
                Assert.AreEqual("34.9", ship.EffectiveAntiSubmarine.ToString("f1"));
            }
Example #21
0
        static void Main(string[] args)
        {
            // Cheat Init
            if (HamsterCheese.AmongUsMemory.Cheese.Init())
            {
                // Update Player Data When Every Game
                HamsterCheese.AmongUsMemory.Cheese.ObserveShipStatus((x) =>
                {
                    //stop observe state for init.
                    foreach (var player in playerDatas)
                    {
                        player.StopObserveState();
                    }


                    playerDatas        = HamsterCheese.AmongUsMemory.Cheese.GetAllPlayers();
                    client             = HamsterCheese.AmongUsMemory.Cheese.GetClient();
                    ship               = HamsterCheese.AmongUsMemory.Cheese.GetShipStatus();
                    gamecode           = HamsterCheese.AmongUsMemory.Cheese.GetGameCode();
                    old_meeting_status = HamsterCheese.AmongUsMemory.Cheese.GetMeetingStatus();
                });

                // Cheat Logic
                CancellationTokenSource cts = new CancellationTokenSource();
                Task.Factory.StartNew(
                    UpdateCheat
                    , cts.Token);
            }

            System.Threading.Thread.Sleep(1000000);
        }
Example #22
0
            public void  種コンビネーション()
            {
                var ship = new ShipStatus
                {
                    Fleet     = new Fleet(null, 0, null),
                    Firepower = 50,
                    Spec      = new ShipSpec
                    {
                        ShipType = 2
                    },
                    AntiSubmarine = 63 + 22,
                    Slot          = new[]
                    {
                        式水中探信儀,
                        式爆雷投射機,
                        九五式爆雷
                    }
                };

                Assert.AreEqual("88.9", ship.EffectiveAntiSubmarine.ToString("f1"));

                ship.AntiSubmarine = 63 + 33;
                ship.Slot          = new[]
                {
                    式水中探信儀,
                    試製15cm9連装対潜噴進砲,
                    九五式爆雷
                };
                Assert.AreEqual("83.8", ship.EffectiveAntiSubmarine.ToString("f1"), "三種コンビネーションにならない");
            }
Example #23
0
 public void TravelTo(Planet target)
 {
     travelTimer = new Timer(Universe.GetDistance(_planet, target) / 10f, false);
     status      = ShipStatus.Traveling;
     _planet     = target;
     _pilot.QueueEvent(EventSpecial.OnTravelStart);
 }
Example #24
0
 public static void Postfix(ShipStatus __instance, [HarmonyArgument(0)] GameData.PlayerInfo?player, ref float __result)
 {
     if (player != null && !player.IsDead && player.GetRole()?.Team == Team.Impostor)
     {
         __result = __instance.MaxLightRadius * PlayerControl.GameOptions.ImpostorLightMod;
     }
 }
Example #25
0
 public void Start()
 {
     height = 330;
     speed  = -5;
     fuel   = 400;
     status = ShipStatus.play;
 }
Example #26
0
        public static bool Prefix(ShipStatus __instance)
        {
            if (JesterMod.EndCriteria.JesterVotedOut)
            {
                return(false);
            }
            if (Utils.Lover1 != null && Utils.Lover2 != null)
            {
                if (__instance.Systems.ContainsKey(SystemTypes.LifeSupp))
                {
                    var lifeSuppSystemType = __instance.Systems[SystemTypes.LifeSupp].Cast <LifeSuppSystemType>();
                    if (lifeSuppSystemType.Countdown < 0f)
                    {
                        return(true);
                    }
                }

                if (__instance.Systems.ContainsKey(SystemTypes.Laboratory))
                {
                    var reactorSystemType = __instance.Systems[SystemTypes.Laboratory].Cast <KJKDNMBDHKJ>();
                    if (reactorSystemType.Field_10 < 0f)
                    {
                        return(true);
                    }
                }
                if (__instance.Systems.ContainsKey(SystemTypes.Reactor))
                {
                    var reactorSystemType = __instance.Systems[SystemTypes.Reactor].Cast <KJKDNMBDHKJ>();
                    if (reactorSystemType.Field_10 < 0f)
                    {
                        return(true);
                    }
                }
                if (Methods.FourPeopleLeft())
                {
                    return(false);
                }
            }

            if (Methods.CheckLoversWin())
            {
                var messageWriter = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId,
                                                                               (byte)CustomRPC.LoveWin, SendOption.Reliable, -1);
                AmongUsClient.Instance.FinishRpcImmediately(messageWriter);
                Methods.LoversWin();
                ShipStatus.RpcEndGame((GameOverReason)2, false);
                return(false);
            }

            if (Methods.CheckNoImpsNoCrews())
            {
                var messageWriter = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId,
                                                                               (byte)CustomRPC.NobodyWins, SendOption.Reliable, -1);
                AmongUsClient.Instance.FinishRpcImmediately(messageWriter);
                Methods.NobodyWins();
                ShipStatus.RpcEndGame((GameOverReason)2, false);
                return(false);
            }
            return(true);
        }
Example #27
0
        private static bool CheckAndEndGameForTaskWin(ShipStatus __instance)
        {
            bool localCompletedAllTasks = true;

            foreach (PlayerTask t in PlayerControl.LocalPlayer.myTasks)
            {
                localCompletedAllTasks = localCompletedAllTasks && t.MOHGOCFFHLF;
            }

            if (!DestroyableSingleton <TutorialManager> .JECNDKBIOFO)
            {
                if (GameData.Instance.TotalTasks <= GameData.Instance.CompletedTasks)
                {
                    __instance.enabled = false;
                    ShipStatus.PBKIGLMJEDH(GameOverReason.HumansByTask, false);
                    return(true);
                }
            }
            else if (localCompletedAllTasks)
            {
                DestroyableSingleton <HudManager> .CMJOLNCMAPD.ShowPopUp(DestroyableSingleton <TranslationController> .CMJOLNCMAPD.GetString(StringNames.GameOverTaskWin, new Il2CppReferenceArray <Il2CppSystem.Object>(0)));

                __instance.Begin();
            }
            return(false);
        }
Example #28
0
        public static bool Prefix(ShipStatus __instance, [HarmonyArgument(0)] GameData.PlayerInfo player,
                                  ref float __result)
        {
            if (player == null || player.IsDead)
            {
                __result = __instance.MaxLightRadius;
                return(false);
            }
            var switchSystem = __instance.Systems[SystemTypes.Electrical].Cast <SwitchSystem>();

            if (player.IsImpostor)
            {
                __result = __instance.MaxLightRadius * PlayerControl.GameOptions.ImpostorLightMod;
                return(false);
            }
            var t = switchSystem.Value / 255f;

            __result = Mathf.Lerp(__instance.MinLightRadius, __instance.MaxLightRadius, t) * PlayerControl.GameOptions.CrewLightMod;
            if (player.Object.isMayor())
            {
                __result = Mathf.Lerp(__instance.MinLightRadius, __instance.MaxLightRadius, t) *
                           CustomGameOptions.MayorVision;
            }
            if (player.Object.isEngineer())
            {
                __result = Mathf.Lerp(__instance.MinLightRadius, __instance.MaxLightRadius, t) *
                           CustomGameOptions.EngineerVision;
            }

            return(false);
        }
Example #29
0
        public static void ImportMap(GameObject map)
        {
            // Ship Status
            ShipStatus shipStatus = map.GetComponent <ShipStatus>();

            // Determine Map Type
            ShipStatus.MapType mapType = ShipStatus.MapType.Pb;
            if (map.name == "AprilShip")
            {
                return;
            }
            if (map.name == "MiraShip")
            {
                mapType = ShipStatus.MapType.Hq;
            }
            if (map.name == "SkeldShip")
            {
                mapType = ShipStatus.MapType.Ship;
            }


            // Import Map to Lists
            ImportMap(map, shipStatus, mapType, tasks);
            ImportMap(map, shipStatus, mapType, utils);
            ImportMap(map, shipStatus, mapType, sabs);
            ImportMap(map, shipStatus, mapType, dec);
            ImportMap(map, shipStatus, mapType, room);
        }
Example #30
0
        private static bool CheckAndEndGameForImpostorWin(ShipStatus __instance, PlayerStatistics statistics)
        {
            if (statistics.TeamImpostorsAlive >= statistics.TotalAlive - statistics.TeamImpostorsAlive && statistics.TeamJackalAlive == 0 && !(statistics.TeamImpostorHasAliveLover && statistics.TeamLoversAlive == 2))
            {
                if (!DestroyableSingleton <TutorialManager> .JECNDKBIOFO)
                {
                    __instance.enabled = false;
                    GameOverReason endReason;
                    switch (TempData.EBGJMGKCIFN)
                    {
                    case DeathReason.Exile:
                        endReason = GameOverReason.ImpostorByVote;
                        break;

                    case DeathReason.Kill:
                        endReason = GameOverReason.ImpostorByKill;
                        break;

                    default:
                        endReason = GameOverReason.ImpostorByVote;
                        break;
                    }
                    ShipStatus.PBKIGLMJEDH(endReason, false);
                    return(true);
                }
                DestroyableSingleton <HudManager> .CMJOLNCMAPD.ShowPopUp(DestroyableSingleton <TranslationController> .CMJOLNCMAPD.GetString(StringNames.GameOverImpostorKills, new Il2CppReferenceArray <Il2CppSystem.Object>(0)));

                ReviveEveryone();
                return(true);
            }
            return(false);
        }
Example #31
0
        public void UpdateStatus(ShipStatus newStatus)
        {
            if (newStatus != Status)
            {
                Status = newStatus;

                _scene.BroadcastStatusChanged(this.id, this.Status);
            }
        }
Example #32
0
	// Use this for initialization
	void Start () {
		status = playerShip.GetComponent<ShipStatus>();
		firingSystem = targetingSystem.GetComponent<MissileFire>();
		mouseControl = playerShip.GetComponent<SmoothMouseLook>();
		
		showNavComm = false;
		stateTimerSec = 0.25f;
		startTime = Time.time;		
	}
Example #33
0
        protected virtual int UpdateIDModifiers(ShipStatus status, Direction facing)
        {
            int intStatus = (int)status;
            int intFacing = (int)facing / 2;

            m_CurrentItemIdModifier = itemIDMods[intStatus, intFacing];
			
			switch (intFacing)
			{
				case 0: 
				{ 
					m_CannonItemIdModifier = 0; 
					m_CannonItemIdModifierSx = -1; 
					m_CannonItemIdModifierDx = 1; 					
					
					break;
				}
				case 1:
				{
					m_CannonItemIdModifier = 1; 
					m_CannonItemIdModifierSx = 0; 
					m_CannonItemIdModifierDx = -2; 					
					
					break;
				}
				case 2: 
				{
					m_CannonItemIdModifier = -2;
					m_CannonItemIdModifierSx = 1; 
					m_CannonItemIdModifierDx = -1; 		
					
					break;
				}
				case 3: 
				{
					m_CannonItemIdModifier = -1;
					m_CannonItemIdModifierSx = -2; 
					m_CannonItemIdModifierDx = 0; 					
					
					break;
				}
			}
			
            return multiIDs[intStatus] + intFacing;
        }
	    public void Insert(string Status,string Code,DateTime? CreatedOn,DateTime? ModifiedOn,string CreatedBy,string ModifiedBy)
	    {
		    ShipStatus item = new ShipStatus();
		    
            item.Status = Status;
            
            item.Code = Code;
            
            item.CreatedOn = CreatedOn;
            
            item.ModifiedOn = ModifiedOn;
            
            item.CreatedBy = CreatedBy;
            
            item.ModifiedBy = ModifiedBy;
            
	    
		    item.Save(UserName);
	    }
Example #35
0
File: Ship.cs Project: dbx386/SBWC
        /// <summary>
        /// Перезагружает статус корабля, ориентируясь на координату, которая была передана
        /// </summary>
        /// <param name="point">Координата, которую необходимо сверить (ячейка, по которой был совершен выстрел)</param>
        public void reloadStatus(Point point)
        {
            bool is_dead = true;// Для проверки не убит ли корабль вовсе
            foreach (Cell curCell in this.shipCells)
            {
                if (curCell.position == point)
                {
                    this.shipStatus = ShipStatus.injured; // Ранен
                    curCell.cellStatus.is_open = true;
                }
                if (curCell.cellStatus.is_open == false)
                {
                    is_dead = false;
                }
            }

            if (is_dead == true)
            {
                this.shipStatus = ShipStatus.dead;
            }
        }
Example #36
0
 public static void BroadcastStatusChanged(this ISceneHost scene, ushort shipId, ShipStatus status)
 {
     
     scene.Broadcast("ship.statusChanged", new StatusChangedMsg { shipId = shipId, status = status });
 }
Example #37
0
 public void Start()
 {
     height = 500;
     fuel = 500;
     speed = -10;
     status = ShipStatus.play;
 }
Example #38
0
 public void Finish()
 {
     status = ShipStatus.wait;
 }
Example #39
0
        //время в ms
        public void MoveShip(float s)
        {
            if (status != ShipStatus.play)
                return;

            if (power)
            {
                fuel -= speed_f * s;
                if (fuel <= 0) //кончилось топливо
                {
                    fuel = 0;
                    power = false;
                }
            }
            if (power)
                speed += s * ship_a; //x += 1 то же, что x = x + 1. Работает и для -=, *=, /=
            else
                speed += s * moon_g;

            height += s * speed;

            if(height <= 0)
            {
                if (Math.Abs(speed) <= 20) //Модуль скорости
                    status = ShipStatus.landing;
                else
                    status = ShipStatus.crash;
                PowerOff();
            }

            if (height > 550)
            {
                status = ShipStatus.flyout;
                PowerOff();
            }
        }
 public void RegisterStatusChanged(ShipStatus shipStatus, long timeStamp)
 {
     this.InsertInHistory(new StatusEvent { NewStatus = shipStatus, TimeStamp = timeStamp });
 }
	    public void Update(int ShipStatusId,string Status,string Code,DateTime? CreatedOn,DateTime? ModifiedOn,string CreatedBy,string ModifiedBy)
	    {
		    ShipStatus item = new ShipStatus();
	        item.MarkOld();
	        item.IsLoaded = true;
		    
			item.ShipStatusId = ShipStatusId;
				
			item.Status = Status;
				
			item.Code = Code;
				
			item.CreatedOn = CreatedOn;
				
			item.ModifiedOn = ModifiedOn;
				
			item.CreatedBy = CreatedBy;
				
			item.ModifiedBy = ModifiedBy;
				
	        item.Save(UserName);
	    }
Example #42
0
	// Use this for initialization
	void Start () {
		shipStats = shipControl.GetComponent<ShipStatus>();
	}
Example #43
0
 internal void BroadcastStatusChanged(ushort shipId, ShipStatus shipStatus)
 {
     if (shipStatus == ShipStatus.Dead)
     {
         Interlocked.Increment(ref this._deathCount);
     }
     this._scene.BroadcastStatusChanged(shipId, shipStatus);
 }