private static void Dispose() { GameData.Dispose(); GameData = default; GameProcess.Dispose(); GameProcess = default; }
// Use this for initialization void Start() { guiText.text = ""; showStart = true; showLogout = true; gp = GameObject.Find("GameProcess").GetComponent<GameProcess>(); }
/// <inheritdoc /> public override bool Update(GameProcess gameProcess) { if (!base.Update(gameProcess)) { return false; } // get matrices MatrixViewProjection = Matrix.TransposeMatrix(gameProcess.ModuleClient.Read<Matrix>(Offsets.dwViewMatrix)); MatrixViewport = GfxMath.GetMatrixViewport(gameProcess.WindowRectangleClient.Size); MatrixViewProjectionViewport = MatrixViewProjection * MatrixViewport; // read data ViewOffset = gameProcess.Process.Read<Vector3>(AddressBase + Offsets.m_vecViewOffset); EyePosition = Origin + ViewOffset; ViewAngles = gameProcess.Process.Read<Vector3>(gameProcess.ModuleEngine.Read<IntPtr>(Offsets.dwClientState) + Offsets.dwClientState_ViewAngles); AimPunchAngle = gameProcess.Process.Read<Vector3>(AddressBase + Offsets.m_aimPunchAngle); Fov = gameProcess.Process.Read<int>(AddressBase + Offsets.m_iFOV); if (Fov == 0) Fov = 90; // correct for default // calc data EyeDirection = GfxMath.GetVectorFromEulerAngles(ViewAngles.X.DegreeToRadian(), ViewAngles.Y.DegreeToRadian()); AimDirection = GfxMath.GetVectorFromEulerAngles ( (ViewAngles.X + AimPunchAngle.X * Offsets.weapon_recoil_scale).DegreeToRadian(), (ViewAngles.Y + AimPunchAngle.Y * Offsets.weapon_recoil_scale).DegreeToRadian() ); return true; }
public float MagicDebuff(GameProcess player1, GameProcess player2, Mechanics Mechs) { RandVar6 = player1.rand6.NextDouble(); if ((Conv.MagicDebuffChance(player1) / 100.0f) > RandVar6) { if (player1.magicEquipped == "Fire") { player2.onFire = Mechs.Convert.MagicDurationFunc(player1); player2.fireDebuff = Mechs.Convert.MagicFireDebuff(player1) / 100.0f; } else if (player1.magicEquipped == "Curse") { player2.cursed = Mechs.Convert.MagicDurationFunc(player1); Debug.Log("Sleep is:" + player1.sleep + " ; " + "Duration is: " + player2.cursed); player2.curseDebuff = Mechs.Convert.MagicCurseDebuff(player1) / 100.0f; } else if (player1.magicEquipped == "Bolt") { return(2); } else if (player1.magicEquipped == "Ice") { player2.bashed = true; } } return(1); }
public virtual bool ContainsProcess(GameProcess realtimeProcess) { lock (this.processes) { return(this.processes.Contains(realtimeProcess)); } }
public virtual void AddProcess(GameProcess realtimeProcess) { lock (this.processes) { this.processes.Add(realtimeProcess); } }
public virtual TArray <GameProcess> DeleteIndex(string id) { TArray <GameProcess> list = new TArray <GameProcess>(); if (processes != null && processes.size > 0) { lock (this.processes) { TArray <GameProcess> ps = new TArray <GameProcess>(processes); for (int i = 0; i < ps.size; i++) { GameProcess p = ps.Get(i); if (p != null) { if (string.ReferenceEquals(p.GetId(), id) || p.GetId().IndexOf(id, StringComparison.Ordinal) != -1) { p.Kill(); processes.Remove(p); list.Add(p); } } } } } return(list); }
public virtual TArray <GameProcess> Delete(GameProcess process) { TArray <GameProcess> list = new TArray <GameProcess>(); if (process == null) { return(list); } if (processes != null && processes.size > 0) { lock (this.processes) { TArray <GameProcess> ps = new TArray <GameProcess>(processes); for (int i = 0; i < ps.size; i++) { GameProcess p = ps.Get(i); if (p != null) { if (process == p || string.ReferenceEquals(process.GetId(), p.GetId()) || process.GetId().Equals(p.GetId())) { p.Kill(); processes.Remove(p); list.Add(p); } } } } } return(list); }
private List <GameProcessItem> GetGameProcessItems(GameProcess gameProcess) { var gameProcessItems = gameProcess.Payments.Where(c => c.Sender != null).GroupBy(c => c.Sender).Select(c => { var gameprocess = new GameProcessItem { PlayerId = c.Key.Id, PlayerName = c.Key.Name, PlayerImage = c.Key.ImageUrl, Input = c.Select(i => new PlayerStuff { Amount = i.Amount, Time = i.CreateDateTime }).ToList() }; var output = gameProcess.Payments.FirstOrDefault(p => p.Recipient != null && p.Recipient.Id == c.Key.Id); if (output != null) { gameprocess.OutPut = new PlayerStuff { Amount = output.Amount, Time = output.CreateDateTime }; } return(gameprocess); }).ToList(); return(gameProcessItems); }
public int FinalMagicDamage(GameProcess player1, GameProcess player2, bool isDebuff) { int Damage; float MultFromRand; player2.animation.setAnimatorBoolTrue("Magic" + player1.magicEquipped); if (!isDebuff) { player1.animation.setAnimatorBoolTrue("PlayerMagicAttack"); MultFromRand = RandomCount.MagicDebuff(player1, player2, this); Damage = (int)(MultFromRand * Convert.MagicDmgFunc(player1)); //Debug.Log("Magic damage: " + MultFromRand + " * " + Convert.MagicDmgFunc(player1)); } else { if (player1.magicEquipped == "Fire") { Damage = (int)(Convert.MagicDmgFunc(player1) / Helper.debuffDmgMultFire); } else { Damage = (int)(Convert.MagicDmgFunc(player1) / Helper.debuffDmgMultCurse); } //Debug.Log("Magic damage: " + Convert.MagicDmgFunc(player1) / Helper.debuffDmgMult); } player1.animation.instantiateText("", new Vector3(0, 0, 0), LocalisationSystem.GetLocalisedValue(player1.magicEquipped), player2.playerObj.transform.position, player2.iAmLeft, false, false, true, true, false); player1.animation.instantiateText(player1.magicEquipped + "Parent", player2.playerObj.transform.position, "- " + Damage.ToString(), player2.playerObj.transform.position, player2.iAmLeft, false, false, true, false, false); return(Damage); }
public int StaminaRestoreSwap(GameProcess player) { int temp; int tempText; //Debug.Log("Curse debuff, so health decreased: " + player.curseDebuff + "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"); temp = (int)(player.sleep * 0.1f) + player.baseStamForSwap; if (player.animation.Animator != null) { if (player.maxStamina != player.stamina) { tempText = player.maxStamina - player.stamina; if (player.stamina + temp <= player.maxStamina) { tempText = temp; } player.animation.instantiateText("", player.playerObj.transform.position, "+ " + tempText.ToString(), player.playerObj.transform.position, player.iAmLeft, false, false, false, false, true); } } else { Debug.Log("NO ANIMATOR"); } return(temp); }
public GameProcessScreen(AskalhornGame game, GameProcess gameProcess) : base(game) { this.GameProcess = gameProcess; _options = Configuration.Options; }
// Use this for initialization void Start() { allowAutoMoveAttackToggle = false; am = GameObject.Find("AudioManager").GetComponent <AudioManager>(); gp = GameObject.Find("GameProcess").GetComponent <GameProcess>(); windowRect1 = new Rect(Screen.width / 2 - 350 / 2, 0, displayWidth, displayHeight); }
public void LoadMod() { try { Configuration.LoadConfiguration(this.Settings); if (Configuration.FirstSetup) { Companion.Colors.Current = Color.SpringGreen; Configuration.CompleteFirstSetup(); Configuration.SaveConfiguration(this.Settings); } Thread.CurrentThread.Name = "main"; Screen.FadeOut(1000); logger.Info("Starting NAL"); GameUI.DisplayHelp(Strings.Start); if (!File.Exists("scripts\\NoArtifactLights.pdb")) { logger.Warn("Attention: No debug database found in game scripts folder. This means logs cannot provide additional information related to exception."); } Process = new GameProcess(Assembly.GetExecutingAssembly().GetName().Version); this.Interval = 100; this.Tick += Entry_Tick; this.Aborted += Entry_Aborted; } #pragma warning disable CA1031 catch (Exception ex) #pragma warning restore CA1031 { Screen.FadeIn(500); logger.Fatal(ex, "Excepting during initial load process"); Abort(); } }
/** * Shows the money tree. * @param int questionNumber current question number, will be selected */ public void ShowMoneyTree(int questionNumber) { GameObject mtree = (GameObject)GameObject.Instantiate(Resources.Load(this.prefabPath + "MoneyTree")); GameObject canvas = GameObject.Find("Canvas"); mtree.transform.SetParent(canvas.transform, false); GameProcess gameProcess = (GameProcess)canvas.GetComponent <GameProcess>(); //removing "(Clone)" suffix from name mtree.transform.name = mtree.transform.name.Replace("(Clone)", "").Trim(); GameObject a = GameObject.Find("QuestionPrize"); int n = this.MoneyTree.Length; for (int i = 0; i < n; i++) { GameObject b = (GameObject)GameObject.Instantiate(a); b.transform.SetParent(mtree.transform, false); b.transform.SetPositionY(a.transform.position.y - 22 * i); //removing "(Clone)" suffix from name b.transform.name = b.transform.name.Replace("(Clone)", "").Trim() + (n - i); Text text = (Text)b.GetComponent <Text>(); text.text = (n - i) < 10 ? " " : ""; text.text += (n - i) + "\t\t" + gameProcess.l.FormatPrize(this.MoneyTree[n - i - 1]); if (System.Array.IndexOf(this.GuaranteedPrizes, n - i) > -1) { text.color = Color.white; } } GameObject.Destroy(a); GameObject currentQuestion = GameObject.Find("CurrentQuestion"); currentQuestion.transform.SetPositionY(currentQuestion.transform.position.y - 22 * (n - questionNumber)); }
public virtual void CleanUp() { if (LauncherProcess != null) { LauncherProcess.Dispose(); LauncherProcess = null; } if (GameProcess == null) { GameProcess = TryToGetGameProcess(); } if (GameProcess != null) { try { if (!GameProcess.HasExitedSafe()) { GameProcess.Kill(); } } catch (Exception e) { Logging.Warning("Process killing exception: " + e); } GameProcess.Dispose(); GameProcess = null; } }
/// <inheritdoc /> public override bool Update(GameProcess gameProcess) { if (!base.Update(gameProcess)) { return(false); } // get matrices MatrixViewProjection = Matrix.TransposeMatrix(gameProcess.ModuleClient.Read <Matrix>(Offsets.dwViewMatrix)); MatrixViewport = GfxMath.GetMatrixViewport(gameProcess.WindowRectangleClient.Size); MatrixViewProjectionViewport = MatrixViewProjection * MatrixViewport; // read data ViewOffset = gameProcess.Process.Read <Vector3>(AddressBase + Offsets.m_vecViewOffset); EyePosition = Origin + ViewOffset; ViewAngles = gameProcess.Process.Read <Vector3>(gameProcess.ModuleEngine.Read <IntPtr>(Offsets.dwClientState) + Offsets.dwClientState_ViewAngles); AimPunchAngle = gameProcess.Process.Read <Vector3>(AddressBase + Offsets.m_aimPunchAngle); Fov = gameProcess.Process.Read <int>(AddressBase + Offsets.m_iFOV); if (Fov == 0) { Fov = 90; // correct for default } // calc data AimDirection = GetAimDirection(ViewAngles, AimPunchAngle); return(true); }
// Token: 0x0600015B RID: 347 RVA: 0x00009D9C File Offset: 0x00007F9C private void UpdateStudioBones(GameProcess gameProcess) { for (int i = 0; i < this.StudioHdr.numbones; i++) { this.StudioBones[i] = gameProcess.Process.Read(this.AddressStudioHdr + this.StudioHdr.boneindex + i * Marshal.SizeOf <mstudiobone_t>()); } }
public virtual TArray <GameProcess> Delete(GameProcessType pt) { TArray <GameProcess> list = new TArray <GameProcess>(); if ((object)pt == null) { return(list); } if (processes != null && processes.size > 0) { lock (this.processes) { TArray <GameProcess> ps = new TArray <GameProcess>(processes); for (int i = 0; i < ps.size; i++) { GameProcess p = ps.Get(i); if (p != null) { if (p.GetProcessType() == pt) { p.Kill(); processes.Remove(p); list.Add(p); } } } } } return(list); }
public override bool Update(GameProcess gameProcess) { if (!base.Update(gameProcess)) { return(false); } // Read data EyePosition = getPlayerEyePosition(gameProcess); ViewAngles = gameProcess.Process.Read <Vector3>(gameProcess.ModuleEngine.Read <IntPtr>(Offsets.dwClientState) + Offsets.dwClientState_ViewAngles); EyeDirection = GfxMath.GetVectorFromEulerAngles(GfxMath.DegreeToRadian(ViewAngles.X), GfxMath.DegreeToRadian(ViewAngles.Y)); AimPunchAngle = gameProcess.Process.Read <Vector3>(AddressBase + Offsets.m_aimPunchAngle); Fov = gameProcess.Process.Read <int>(AddressBase + Offsets.m_iFOV); if (Fov == 0) { Fov = 90; // correct for default } // Update player info vecVelocity = getPlayerVecVelocity(gameProcess); ActiveWeapon = getActiveWeapon(gameProcess); UpdatePrimaryWeapon(ActiveWeapon); AmmoCount = AmmoCounter(gameProcess); HasDefuseKit = checkIfHasDefuseKit(gameProcess); isAimingDownScope = checkIfAds(gameProcess); CanShoot = checkIfCanShoot(gameProcess); CursorLocked = checkIfCursorLocked(gameProcess); Location = getPlayerLocation(gameProcess); // calc data AimDirection = GetAimDirection(ViewAngles, AimPunchAngle); return(true); }
public int HealthRestoreFunc(GameProcess player) { int temp; int tempText; //Debug.Log(player.regBonus + " " + player.curseDebuff + "sssssssssssssssssssssssssssssssssss"); temp = (int)(((player.regen * 0.3f) + player.baseHealthForSleep) * (1 + player.regBonus - 2 * player.curseDebuff)); if (player.animation.Animator != null) { if (player.maxHealth != player.health) { tempText = player.maxHealth - player.health; if (player.health + temp <= player.maxHealth) { tempText = temp; } player.animation.instantiateText("", player.playerObj.transform.position, "+ " + tempText.ToString(), player.playerObj.transform.position, player.iAmLeft, false, true, false, false, false); } } return(temp); }
// Token: 0x06000197 RID: 407 RVA: 0x0000A5A0 File Offset: 0x000087A0 public bool IsArmingBomb(GameProcess gameProcess) { int num = gameProcess.Process.Read(base.AddressBase + Offsets.m_hActiveWeapon) & 4095; IntPtr pointer = gameProcess.ModuleClient.Read(Offsets.dwEntityList + (num - 1) * 16); return(gameProcess.Process.Read(pointer + Offsets.m_iItemDefinitionIndex) == 49 && gameProcess.Process.Read(pointer + Offsets.m_bStartedArming)); }
void Start() { allowAutoMoveAttackToggle = true; menuTexture = (Texture2D)Resources.Load("PopupMenuBG"); am = GameObject.Find("AudioManager").GetComponent <AudioManager>(); gp = GameObject.Find("GameProcess").GetComponent <GameProcess>(); }
// Token: 0x06000196 RID: 406 RVA: 0x0000A540 File Offset: 0x00008740 public short getActiveWeapon(GameProcess gameProcess) { int num = gameProcess.Process.Read(base.AddressBase + Offsets.m_hActiveWeapon) & 4095; IntPtr pointer = gameProcess.ModuleClient.Read(Offsets.dwEntityList + (num - 1) * 16); return(gameProcess.Process.Read(pointer + Offsets.m_iItemDefinitionIndex)); }
public async Task <ServiceResult> CreateGameProcess(int gameId) { var user = await authService.GetCurrentUser(); if (!user.IsSuccess) { return(Error(user.ErrorMessage)); } var game = await GetGameByPlayerRoles(gameId, PlayerRole.Creator); if (!game.IsSuccess) { return(Error(game.ErrorMessage)); } if (game.Data.GameState != GameState.RecordingPlaysers) { return(Error("Игровой процесс уже создан")); } if (context.GameProcesses.Any(x => x.GameId == gameId)) { return(Error("Игровой процесс уже создан")); } game.Data.GameState = GameState.Playing; var gameProcess = new GameProcess { CreateDate = DateTime.Now, StartTime = game.Data.PlaneStartDate, GameId = gameId }; context.GameProcesses.Add(gameProcess); await context.SaveChangesAsync(); return(Success((object)gameProcess.Id)); }
private void Tags(GameProcess game) { for (uint i = 0; i < 100; i++) { var tag = game.TagCache.GetTag(i); } }
// Token: 0x06000159 RID: 345 RVA: 0x00009CC8 File Offset: 0x00007EC8 private void UpdateStudioHdr(GameProcess gameProcess) { IntPtr lpBaseAddress = gameProcess.Process.Read(base.AddressBase + Offsets.m_pStudioHdr); this.AddressStudioHdr = gameProcess.Process.Read(lpBaseAddress); this.StudioHdr = gameProcess.Process.Read(this.AddressStudioHdr); }
public int HealthRestoreSwap(GameProcess player) { int temp; int tempText; //Debug.Log("Curse debuff, so health decreased: " + player.curseDebuff + "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"); temp = (int)(((player.regen * 0.1f) + player.baseHealthForSwap) * (1 + player.regBonus - player.curseDebuff)); if (player.animation.Animator != null) { if (player.maxHealth != player.health) { tempText = player.maxHealth - player.health; if (player.health + temp <= player.maxHealth) { tempText = temp; } player.animation.instantiateText("", player.playerObj.transform.position, "+ " + tempText.ToString(), player.playerObj.transform.position, player.iAmLeft, false, true, false, false, false); } } else { Debug.Log("NO ANIMATOR"); } return(temp); }
//销毁该房间 private void destoryGameLobby() { for (int i = 0; i < 4; i++) { players[i] = null; } gameProcess = null; }
public GameProcessViewModel(GameProcess model) { Id = model.Id; CreateDate = model.CreateDate; StartTime = model.StartTime; State = model.State; GameId = model.GameId; }
public virtual async Task WaitGameAsync(CancellationToken cancellation) { if (GameProcess == null) { return; } await GameProcess.WaitForExitAsync(cancellation); }
void Start() { this.renderer.enabled = false; pawn = GameObject.Find("Red1").GetComponent<Red1>(); boardPosition = 0; roundBend = false; gp = GameObject.Find("GameProcess").GetComponent<GameProcess>(); leftStart = false; }
void Start() { gp = GameObject.Find("GameProcess").GetComponent<GameProcess>(); this.renderer.enabled = false; roundBend = false; leftStart = false; pawn = GameObject.Find("Yellow1").GetComponent<Yellow1>(); boardPosition = 0; }
// Use this for initialization void Start() { gp = GameObject.Find("_GameManager").GetComponent<GameProcess>(); lastY = 128; transform.position = new Vector3 (8, 0, 0); }
// Use this for initialization void Start() { gp = GameObject.Find("GameProcess").GetComponent<GameProcess>(); }
void Start() { gp = GameObject.Find("GameProcess").GetComponent<GameProcess>(); lastPosition = gameObject.transform.position ; }
void Start() { process = GameObject.Find("GameProcess").GetComponent<GameProcess>(); net = LoginScript.net; }
// Use this for initialization void Start() { gp = GameObject.Find("_GameManager").GetComponent<GameProcess>(); }
// Use this for initialization void Start() { xVelocity = 0; yVelocity = 0; currentXPosition = -2.5f; lastXPosition = -2.5f; currentXVelocity = 0.0f; lastXVelocity = 0.0f; currentYVelocity = 0.0f; lastYVelocity = 0.0f; currentYPosition = 0f; lastYPosition = 0f; threshold = 0.05f; weight = 1; score = 0; gp = GameObject.Find("GameProcess").GetComponent<GameProcess>(); StartCoroutine ( SendDelay() ); }
void Awake() { instance = this; }
/// <summary> /// Queues the specified process to be executed right after this one. /// </summary> /// <param name="next">Process to start after this one has finished.</param> /// <returns> /// <paramref name="next" /> /// </returns> public GameProcess Then(GameProcess next) { this.Next = next; return next; }
//Handles collisions of pawns on the board public static void doesCollide( ref GameProcess gp ) { for ( int i = 0 ; i < gp.playerPositions.Length ; ++ i ) { if ( (i+1) != gp.turn ) { if ( gp.playerPositions[i] != 0 && gp.playerPositions[i] == gp.playerPositions[gp.turn-1] ) { gp.playerPositions[i] = 0; return; } } } }
//GAME FUNCTION ! public static bool findMove( Vector3 pawnParam, ref GameProcess gp ) { switch ( gp.turn ) { case 1: //WINNING CONDITIONS if ( gp.playerPositions[0] == 0 ) { if ( eucD ( new Vector2 ( pawnParam.x, pawnParam.y) , new Vector2 ( positions[5].x, positions[5].y )) < proxThresh) { gp.p1.leftStart = true; gp.playerPositions[0] = 5; gp.pawnObjects[0].transform.position = new Vector3 ( positions[5].x, positions[5].y , positions[5].z ); return true; } } else if ( (gp.playerPositions[0] + gp.forwardMove == 64 || gp.playerPositions[0] + gp.forwardMove == (p1EndLoc+1)) && (gp.playerPositions[0] > 52 || ( gp.playerPositions[0] >= 1 && gp.playerPositions[0] <= p1EndLoc)) && gp.p1.leftStart ) { gp.winningMove = gp.turn; return true; } else if ( (gp.playerPositions[0] + gp.forwardMove > 63 || ((gp.playerPositions[0] <= p1EndLoc ) ? gp.playerPositions[0] + gp.forwardMove > p1EndLoc : false )) && (gp.playerPositions[0] > 52 || ( gp.playerPositions[0] >= 1 && gp.playerPositions[0] <= p1EndLoc)) && gp.p1.leftStart && !didMoveBack(pawnParam, ref gp) ) { return true; } break; case 2://WINNING CONDITIONS if ( gp.playerPositions[1] == 0 ) { if ( eucD ( new Vector2 ( pawnParam.x, pawnParam.y) , new Vector2 ( positions[20].x, positions[20].y )) < proxThresh) { gp.p2.leftStart = true; gp.playerPositions[1] = 20; gp.pawnObjects[1].transform.position = new Vector3 ( positions[20].x, positions[20].y , positions[20].z ); return true; } } else if ( gp.playerPositions[1] + gp.forwardMove == (p2EndLoc+1) && ( gp.playerPositions[1] >= 7 && gp.playerPositions[1] <= p2EndLoc) && gp.p2.leftStart ) { gp.winningMove = gp.turn; return true; } else if ( gp.playerPositions[1] + gp.forwardMove > p2EndLoc && ( gp.playerPositions[1] >= 7 && gp.playerPositions[1] <= p2EndLoc) && gp.p2.leftStart && !didMoveBack(pawnParam, ref gp) ) { return true; } break; case 3://WINNING CONDITIONS if ( gp.playerPositions[2] == 0 ) { if ( eucD ( new Vector2 ( pawnParam.x, pawnParam.y) , new Vector2 ( positions[35].x, positions[35].y )) < proxThresh) { gp.p3.leftStart = true; gp.playerPositions[2] = 35; gp.pawnObjects[2].transform.position = new Vector3 ( positions[35].x, positions[35].y , positions[35].z ); return true; } } else if ( gp.playerPositions[2] + gp.forwardMove == (p3EndLoc+1) && ( gp.playerPositions[2] >= 22 && gp.playerPositions[2] <= p3EndLoc) && gp.p3.leftStart ) { gp.winningMove = gp.turn; return true; } else if ( gp.playerPositions[2] + gp.forwardMove > p3EndLoc && ( gp.playerPositions[2] >= 22 && gp.playerPositions[2] <= p3EndLoc) && gp.p3.leftStart && !didMoveBack(pawnParam, ref gp) ) { return true; } break; case 4://WINNING CONDITIONS if ( gp.playerPositions[3] == 0 ) { if ( eucD ( new Vector2 ( pawnParam.x, pawnParam.y) , new Vector2 ( positions[50].x, positions[50].y )) < proxThresh) { gp.p4.leftStart = true; gp.playerPositions[3] = 50; gp.pawnObjects[3].transform.position = new Vector3 ( positions[50].x, positions[50].y , positions[50].z ); return true; } } else if ( gp.playerPositions[3] + gp.forwardMove == (p4EndLoc+1) && ( gp.playerPositions[3] >= 37 && gp.playerPositions[3] <= p2EndLoc) && gp.p4.leftStart ) { gp.winningMove = gp.turn; return true; } else if ( gp.playerPositions[3] + gp.forwardMove > p4EndLoc && ( gp.playerPositions[3] >= 37 && gp.playerPositions[3] <= p4EndLoc) && gp.p4.leftStart && !didMoveBack(pawnParam, ref gp) ) { return true; } break; default : break; } switch ( gp.forwardMove ) { case 10: //ROLL OF 10 MOVED FORWARD if ( eucD ( new Vector2 ( pawnParam.x, pawnParam.y) , new Vector2 ( positions[gp.forwardMove + gp.playerPositions[gp.turn-1]].x, positions[gp.forwardMove + gp.playerPositions[gp.turn-1]].y )) < proxThresh) { gp.playerPositions[gp.turn-1] += gp.forwardMove; gp.pawnObjects[gp.turn-1].transform.position = new Vector3 ( positions[ gp.playerPositions[gp.turn-1]].x, positions[ gp.playerPositions[gp.turn-1]].y , positions[ gp.playerPositions[gp.turn-1]].z ); return true; } else //ROLL OF 10 MOVED BACK { int movedBack = gp.backMove + gp.playerPositions[gp.turn-1]; if ( movedBack <= 0 ) movedBack += 60; if ( eucD ( new Vector2 ( pawnParam.x, pawnParam.y) , new Vector2 ( positions[movedBack].x, positions[movedBack].y )) < proxThresh) { gp.playerPositions[gp.turn-1] += gp.backMove; if ( gp.playerPositions[gp.turn-1] <= 0 ) gp.playerPositions[gp.turn-1] += 60; gp.pawnObjects[gp.turn-1].transform.position = new Vector3 ( positions[ gp.playerPositions[gp.turn-1]].x, positions[ gp.playerPositions[gp.turn-1]].y , positions[ gp.playerPositions[gp.turn-1]].z ); return true; } } break; case 11: //ROLL OF 11 MOVED OR BUMBED if ( eucD ( new Vector2 ( pawnParam.x, pawnParam.y) , new Vector2 ( positions[gp.forwardMove + gp.playerPositions[gp.turn-1]].x, positions[gp.forwardMove + gp.playerPositions[gp.turn-1]].y )) < proxThresh) { gp.playerPositions[gp.turn-1] += gp.forwardMove; gp.pawnObjects[gp.turn-1].transform.position = new Vector3 ( positions[ gp.playerPositions[gp.turn-1]].x, positions[ gp.playerPositions[gp.turn-1]].y , positions[ gp.playerPositions[gp.turn-1]].z ); return true; } for ( int i = 0 ; i < gp.playerPositions.Length ; ++i ) { if ( (i+1) != gp.turn ) { if ( gp.playerPositions[i] != 0 && eucD ( new Vector2 ( pawnParam.x, pawnParam.y) , new Vector2 ( positions[ gp.playerPositions[i]].x, positions[gp.playerPositions[i]].y )) < proxThresh) { gp.playerPositions[gp.turn-1] = gp.playerPositions[i]; gp.playerPositions[i] = 0; gp.pawnObjects[i].transform.position = startPositions[i] ; gp.pawnObjects[gp.turn-1].transform.position = new Vector3 ( positions[ gp.playerPositions[gp.turn-1]].x, positions[ gp.playerPositions[gp.turn-1]].y , positions[ gp.playerPositions[gp.turn-1]].z ); return true; } } } break; case -200: //ROLL OF SORRY for ( int i = 0 ; i < gp.playerPositions.Length ; ++i ) { if ( (i+1) != gp.turn ) { if ( gp.playerPositions[i] != 0 && eucD ( new Vector2 ( pawnParam.x, pawnParam.y) , new Vector2 ( positions[ gp.playerPositions[i]].x, positions[gp.playerPositions[i]].y )) < proxThresh) { gp.playerPositions[i] = 0; gp.pawnObjects[i].transform.position = startPositions[i] ; return true; } } } return true; default : //ALL OTHER ROLLS if ( eucD ( new Vector2 ( pawnParam.x, pawnParam.y) , new Vector2 ( positions[gp.forwardMove + gp.playerPositions[gp.turn-1]].x, positions[gp.forwardMove + gp.playerPositions[gp.turn-1]].y )) < proxThresh && (gp.forwardMove + gp.playerPositions[gp.turn-1]) > 0 ) { gp.playerPositions[gp.turn-1] += gp.forwardMove; if ( gp.playerPositions[gp.turn-1] <= 0 ) gp.playerPositions[gp.turn-1] += 60; gp.pawnObjects[gp.turn-1].transform.position = new Vector3 ( positions[ gp.playerPositions[gp.turn-1]].x, positions[ gp.playerPositions[gp.turn-1]].y , positions[ gp.playerPositions[gp.turn-1]].z ); return true; } else { int movedBack = gp.backMove + gp.playerPositions[gp.turn-1]; if ( movedBack <= 0 ) movedBack += 60; if ( eucD ( new Vector2 ( pawnParam.x, pawnParam.y) , new Vector2 ( positions[movedBack].x, positions[movedBack].y )) < proxThresh) { gp.playerPositions[gp.turn-1] += gp.backMove; if ( gp.playerPositions[gp.turn-1] <= 0 ) gp.playerPositions[gp.turn-1] += 60; gp.pawnObjects[gp.turn-1].transform.position = new Vector3 ( positions[ gp.playerPositions[gp.turn-1]].x, positions[ gp.playerPositions[gp.turn-1]].y , positions[ gp.playerPositions[gp.turn-1]].z ); return true; } } break; } return false; }
void Start() { connected = false; process = GameObject.Find("GameProcess").GetComponent<GameProcess>(); latency = -1; userName = ""; password = ""; ip = ""; }
//Did the pawn move a space back? public static bool didMoveBack( Vector3 pawnParam, ref GameProcess gp ) { int movedBack = gp.backMove + gp.playerPositions[gp.turn-1]; if ( movedBack <= 0 ) movedBack += 60; if ( (gp.roll == 8 || gp.roll == 4) && eucD ( new Vector2 ( pawnParam.x, pawnParam.y ) , new Vector2 ( positions[movedBack].x,positions[movedBack].y)) < proxThresh ) { return true; } return false; }