void Start() { originalStartingPoint = transform.position; originalTimeScale = Time.timeScale; gameLogic = GameObject.FindWithTag ("GameLogic").GetComponent<GameLogic> (); startTrigger = GameObject.FindWithTag ("StartTrigger").GetComponent<StartTrigger> (); }
public GameState( ) { if ( Main.Instance.GameLogic != null ) { _gameLogic = Main.Instance.GameLogic; } }
public static IDisplay createAndRun(GameLogic.Game g) { Display d = new Display(g); Action a = () => Application.Run(d); a.BeginInvoke(null, null); return d; }
void Start() { gamelogic = GameObject.Find("Logic").GetComponent<GameLogic>(); shotgun = GetComponent<Shotgun>(); birdlauncher = GetComponent<BirdLauncher>(); position = new Rect ((Screen.width - crosshairTexture.width) / 2, (Screen.height - crosshairTexture.height) / 2, crosshairTexture.width/2, crosshairTexture.height/2); }
void Awake() { // if "balls" was static, we would want to Clear() the list to make sure it doesn't carry over from a previous scene balls.Clear(); instance = this; }
void Awake() { SetupPlatformDependentInput(); Rigidbody = GetComponent<Rigidbody>(); logic = GameObject.FindObjectOfType<GameLogic>(); //logic.InitializePlayerList(); logic.PlayerControls.Add(this); }
// Use this for initialization void Start () { logic = GameObject.FindGameObjectWithTag("GameLogic").GetComponent<GameLogic>(); audioSounds = GetComponent<AudioSource>(); soundClick = Resources.Load<AudioClip>("Sounds/click") as AudioClip; soundBonus = Resources.Load<AudioClip>("Sounds/bonus") as AudioClip; soundExplosion = Resources.Load<AudioClip>("Sounds/explosion") as AudioClip; }
private Material GetMaterialByOwner(GameLogic.Owner owner) { Material material; switch (owner) { case GameLogic.Owner.Contagion: { material = Mat_Contagion; } break; case GameLogic.Owner.Player: { material = Mat_Player; } break; case GameLogic.Owner.PowerUp: { material = Mat_PowerUp; } break; case GameLogic.Owner.Neutral: default: { material = Mat_Neutral; } break; } return material; }
public void GameStateChanged(GameLogic.GameState gameState) { AudioClip newClip; if (gameState == GameLogic.GameState.Completed) { newClip = completed; } else if (gameState == GameLogic.GameState.Destroyed) { newClip = destroyed; } else if (gameState == GameLogic.GameState.Playing) { int indexOfClip = GameLogic.GetInstance().GetCurrentTotalNumberOfRounds() % playing.Length; newClip = playing[indexOfClip]; } else if (gameState == GameLogic.GameState.Initializing) { newClip = completed; } else if (gameState == GameLogic.GameState.Menu) { newClip = completed; } else { Debug.LogError("Unexpected GameState: " + gameState); return; } availableAudioSource.clip = newClip; availableAudioSource.time = playingAudioSource.time; availableAudioSource.pitch = playingAudioSource.pitch; availableAudioSource.volume = 0.0f; availableAudioSource.Play (); AudioSource temp = playingAudioSource; playingAudioSource = availableAudioSource; availableAudioSource = temp; }
// Use this for initialization void Start() { gl = (GameLogic)FindObjectOfType(typeof(GameLogic)); ft = (FractalTexture)FindObjectOfType(typeof(FractalTexture)); pl = (Player)FindObjectOfType(typeof(Player)); whiteNoise = GameObject.Find("WhiteNoise"); Debug.Log("White Noise: " + whiteNoise.ToString()); }
void Awake(){ instance = this; labourLimit = 10; woodNumber = 10; labourInUse = 0; arrowNumber = 0; textAlert = GameObject.Find ("AlertText").GetComponent<Text> (); }
void Awake() { gamelogic = GameObject.Find("Logic").GetComponent<GameLogic>(); gamelogic.incrementLaunchedBirds (); Vector3 randomDir = ExtRandom<Vector3>.RandomSpread ((GameObject.Find("Bird Aimpoint").transform.position - gameObject.transform.position), spreadX, spreadY, spreadZ); rigidbody.AddForce (randomDir.normalized * velocity, ForceMode.Impulse); }
public void GoSceneLogin(string json) { //Debug.Log ("Logout: " + json); isInRoom = false; StopAllCoroutines (); instance = null; Application.LoadLevel ("Login"); Destroy (this.gameObject); }
// Use this for initialization void Start() { #if (UNITY_IPHONE || UNITY_ANDROID) // Switch platform input isMobile = true; #endif logic = GameObject.Find("/Logic").GetComponent<GameLogic>(); }
private void ClaimInDirection(GameLogic logic, Vector2Int direction) { Vector2Int toClaim = positionOnBoard + direction; while (logic.GameBoard.IsValidPlayerMove(toClaim)) { logic.GameBoard.SetOwner(toClaim, GameLogic.Owner.Player); toClaim += direction; } }
public static HashSet<GamePosition> generateMoves(GameLogic gameLogic, int playerID, GamePosition gamePosition) { HashSet<Node> moves = gameLogic.GetPossibleMoves(playerID, gamePosition); HashSet<GamePosition> possibleMoves = new HashSet<GamePosition>(); foreach(Node move in moves){ possibleMoves.Add(gameLogic.ApplyMove(playerID, move, gamePosition)); } return possibleMoves; }
//private Quaternion startingRotation; void Start() { // Cache my transform. myTransform = transform; player = GameObject.FindGameObjectWithTag("Player").transform; gameLogic = GameObject.Find("GameLogic").GetComponent<GameLogic>(); if (myType == EnemyType.Burrowing && !hasWaypoints) Debug.LogError("ERROR: Burrowing enemies require waypoints!"); }
void Start() { button = gameObject.GetComponent<Button> (); logic = GameObject.FindGameObjectWithTag ("GameController").GetComponent<GameLogic>(); getNecessaryThingsForUI(); if (cooldownOnStart) { ActivateCooldown (); } }
public PlayScreen() { start = new DateTime(2014, 5, 5); DateTime dateToStart = new DateTime(2015, 5, 5); end = new DateTime(2016, 5, 2); gl = new GameLogic(dateToStart, 100000M); gl.getData("C", start.ToString("yyyyMMdd"), end.ToString("yyyyMMdd")); gl.getData("JPM", start.ToString("yyyyMMdd"), end.ToString("yyyyMMdd")); }
/// <summary> /// Add background game /// </summary> public void AddClient() { GameLogic addedClient = new GameLogic(AppId, GameVersion); addedClient.SetUseInterestGroups(localPlayer.UseInterestGroups); addedClient.CallConnect(); GameObject playerCube = GameObject.CreatePrimitive(PrimitiveType.Cube); playerCube.name = addedClient.NickName; cubes.Add(playerCube); backgroundGames.Add(addedClient.NickName, addedClient); }
public void Start() { EnemyCount = 0; roundNumber = 1; waveNumber = 0; spawnRoundNumber = -1; gameLogic = this; round = null; //SetupGame (); }
public override void GrantEffect(GameLogic logic) { Vector2Int[] directions = Vector2Int.GetCardinalDirections(); for (int i = 0; i < directions.Length; i++) { if (CanClaimDirection(logic, directions[i])) { ClaimInDirection(logic, directions[i]); } } }
public void CmdAttackUnit(int aX, int aZ, int aH, int bX, int bZ, int bH) { if (logic == null) { logic = (GameLogic)FindObjectOfType (typeof(GameLogic)); } if (!logic.isPlayersTurn (getPlayerIdByConnection (connectionToClient))) { return; } GameObject heroAttacker = logic.getUnitOnTile (aX, aZ, aH); if (heroAttacker == null) { Debug.LogError ("hero was null in rpcMoveUnit"); return; } GameObject heroDeffender = logic.getUnitOnTile (bX, bZ, bH); if (heroDeffender == null) { Debug.LogError ("hero was null in rpcMoveUnit"); return; } HeroInfo heroInfoA = heroAttacker.GetComponent<HeroInfo> (); HeroInfo heroInfoB = heroDeffender.GetComponent<HeroInfo> (); if (heroInfoA == null) { Debug.LogError ("Hero Attacker was null"); return; } if (heroInfoB == null) { Debug.LogError ("Hero Deffender was null"); return; } if (!logic.isPlayersTurn (getPlayerIdByConnection (connectionToClient))) { return; } if (heroInfoA.player != getPlayerIdByConnection (connectionToClient)) { Debug.Log ("You don't own that player you fool"); return; } if (GameLogicUtils.canHeroAttackUnit (heroInfoA, heroInfoB)) { // get the server to do this if (isServer && !isClient) { AttackUnit (aX, aZ, aH, bX, bZ, bH); } // get the client to do this.. RpcAttackUnit (aX, aZ, aH, bX, bZ, bH); logic.AttackFinished (); } }
public override void GrantEffect(GameLogic logic) { GameBoard board = logic.GameBoard; Vector2Int[] spotsToClaim = positionOnBoard.GetAdjacent(); for (int i = 0; i < spotsToClaim.Length; i++) { if (board.IsValidPlayerMove(spotsToClaim[i])) { board.SetOwner(spotsToClaim[i], GameLogic.Owner.Player); } } }
public GameEnvironment(EngineContext context) { Context = context; Populator = new GameEnvironmentPopulator (this); PersonCreator = new PersonCreator (context.Settings); PlantCreator = new PlantCreator (context.Settings); Tiles = new GameTile[]{}; People = new Person[] {}; Plants = new Plant[]{ }; Logic = new GameLogic (); Tiles = new GameTile[]{new GameTile(this)}; }
private void Awake() { if (Instance != null) { Destroy(gameObject); return; } Instance = this; if(_gameplayObject != null) _gameplayObject.SetActive(false); }
void Awake() { if (instance != null && instance != this) { Destroy( this.gameObject ); return; } else { instance = this; DontDestroyOnLoad(instance.gameObject); } }
public void GetCubesOfType(GameLogic.Owner owner, out List<Vector2Int> cubes) { cubes = new List<Vector2Int>(); for (int y = 0; y < GAME_BOARD_DIMENSION; y++) { for (int x = 0; x < GAME_BOARD_DIMENSION; x++) { if (_gameCubes[y * GAME_BOARD_DIMENSION + x].Owner == owner) { cubes.Add(new Vector2Int(x, y)); } } } }
public Gui() { InitializeComponent(); logic = new GameLogic(); inputText.KeyUp += new KeyEventHandler(MessageText_KeyUp); messageLog = new Queue<string>(); maxLogSize = 10; logPointer = 0; string intro = logic.getIntro(); displayText(intro); inputText.Focus(); }
public void InitializeGame(int i_BoardSize, Enums.eGameType i_GameType, ref string io_ErrorMessage) { if (i_BoardSize < GameLogic.k_MinimumBoardSize || i_BoardSize > GameLogic.k_MaximumBoardSize) { io_ErrorMessage = "Board size is illegal!"; } else if (i_GameType != Enums.eGameType.PlayerVsComputer && i_GameType != Enums.eGameType.PlayerVsPlayer) { io_ErrorMessage = "Game type is illegal!"; } else { m_GameLogic = new GameLogic(i_BoardSize, i_GameType); } }
void Start() { MyGameLogic = GameObject.Find("GameLogic").GetComponent <GameLogic> (); MySlider.value = MyGameLogic.GetNumberOfPlayers(); SliderText.text = MySlider.value.ToString(); }
private void AfterEnemyDamaged1(EnemyCard target) { GameLogic.Get().m_afterEnemyDamagedEvent.RemoveListener(m_afterEnemyDamaged1); Player.Get().m_investigatorCard.m_combat -= 1; }
public void AddBuff(BuffResult buff) { if (null == ObjManager.Instance.MyPlayer) { return; } // 如果5秒内,这个buff还没有被处理,那就算了 // 通常这种情况发生于切后台后,服务器向客户端广播了很多buff // 但是客户端在后台没法处理,就累积起来了 if (buff.ViewTime > 0 && buff.Type != BuffType.HT_RELIVE && buff.Type != BuffType.HT_DIE && buff.Type != BuffType.HT_ADDBUFF && buff.Type != BuffType.HT_DELBUFF && buff.Type != BuffType.HT_MOVE) { var viewTime = Extension.FromServerBinary((long)buff.ViewTime).AddSeconds(5); if (viewTime < Game.Instance.ServerTime) { return; } } var character = ObjManager.Instance.FindCharacterById(buff.TargetObjId); if (null == character) { //Logger.Warn("Don't find character[{0}].Buff[{1}]", buff.TargetObjId, (int)buff.Type); return; } if (buff.Type == BuffType.HT_RELIVE) { character.Relive(); return; } if (buff.Type != BuffType.HT_MOVE) { character.ShowDamage(buff); } switch (buff.Type) { case BuffType.HT_NORMAL: case BuffType.HT_CRITICAL: case BuffType.HT_EXCELLENT: case BuffType.HT_MISS: { if (buff.Type != BuffType.HT_MISS) { //如果是这种伤害类型就不播被击动作 if (buff.Param.Count > 0) { if (3 == buff.Param[0]) { break; } } if (character.GetObjType() == OBJ.TYPE.NPC) { if (character.GetCurrentStateName() == OBJ.CHARACTER_STATE.RUN) { //character.GetAnimationController().Animation.Blend("Hit", 0.5f); character.PlayAnimation(OBJ.CHARACTER_ANI.HIT, ani => { if (character.GetCurrentStateName() == OBJ.CHARACTER_STATE.RUN) { character.PlayAnimation(OBJ.CHARACTER_ANI.RUN); } }); } else { character.DoHurt(); } } else { character.DoHurt(); } } var otherPlayer = ObjManager.Instance.FindObjById(buff.SkillObjId); var autoCombatData = UIManager.Instance.GetController(UIConfig.SettingUI).GetDataModel("AutoCombat") as AutoCombatData; if (autoCombatData == null || otherPlayer == null) { return; } //当被其他玩家攻击的时候,会进入自动反击的状态 if (otherPlayer.GetObjType() == OBJ.TYPE.OTHERPLAYER && autoCombatData.IsResponded) { if (buff.TargetObjId == ObjManager.Instance.MyPlayer.GetObjId()) { ObjManager.Instance.MyPlayer.freeTime = 0; PlayerDataManager.Instance.ChangePkModel(3); //EventDispatcher.Instance.DispatchEvent(new UpdatePKModelEvent()); GameControl.Instance.TargetObj = otherPlayer as ObjCharacter; ObjManager.Instance.MyPlayer.EnterAutoCombatEx(); } } else { if (buff.TargetObjId == ObjManager.Instance.MyPlayer.GetObjId() && ObjManager.Instance.MyPlayer.freeTime > 10.0f) { //连续受击超过十秒切自动战斗 ObjManager.Instance.MyPlayer.freeTime = 0; ObjManager.Instance.MyPlayer.EnterAutoCombatEx(); } } } break; case BuffType.HT_CHANGE_SCENE: { EventDispatcher.Instance.DispatchEvent(new UIEvent_SyncBuffCell(buff)); character.AddBuff(buff.BuffId, buff.BuffTypeId, buff.SkillObjId, buff.TargetObjId, false); } break; case BuffType.HT_ADDBUFF: { EventDispatcher.Instance.DispatchEvent(new UIEvent_SyncBuffCell(buff)); character.AddBuff(buff.BuffId, buff.BuffTypeId, buff.SkillObjId, buff.TargetObjId); var table = Table.GetBuff(buff.BuffTypeId); if (null != table) { if (6 == table.Type) { //眩晕 character.DoDizzy(); } } } break; case BuffType.HT_DIE: { var delay = (float)(Extension.FromServerBinary((long)buff.ViewTime) - Game.Instance.ServerTime).TotalSeconds; if (delay <= 0.01) { character.DoDie(); } else { character.DeleteObjTime = Time.time + delay; character.DelayDie(delay); } Logger.Debug("Die character[{0}].Buff[{1}]", buff.TargetObjId, (int)buff.Type); } break; case BuffType.HT_HEALTH: break; case BuffType.HT_DELBUFF: { EventDispatcher.Instance.DispatchEvent(new UIEvent_SyncBuffCell(buff)); character.RemoveBuff(buff.BuffId); var table = Table.GetBuff(buff.BuffTypeId); if (null != table) { if (6 == table.Type) { //眩晕 if (character.GetCurrentStateName() == OBJ.CHARACTER_STATE.DIZZY) { character.DoIdle(); } } } } break; case BuffType.HT_RELIVE: character.DoIdle(); break; case BuffType.HT_EFFECT: { var record = Table.GetBuff(buff.BuffTypeId); if (record == null) { Logger.Log2Bugly(" AddBuff record = null"); return; } EventDispatcher.Instance.DispatchEvent(new UIEvent_SyncBuffCell(buff)); // 技能范围指示 if (buff.Param.Count == 6) { ShowSkillIndicator(buff, character); } if (ObjManager.Instance == null || ObjManager.Instance.MyPlayer == null) { Logger.Log2Bugly(" AddBuff ObjManager.Instance.MyPlayer= null"); return; } if (SoundManager.Instance == null || EffectManager.Instance == null) { Logger.Log2Bugly(" AddBuff SoundManager.Instance= null"); return; } var isSelfCast = buff.SkillObjId == ObjManager.Instance.MyPlayer.GetObjId(); var showCameraShake = buff.TargetObjId == ObjManager.Instance.MyPlayer.GetObjId() || isSelfCast; { var oldBuff = character.GetBuff(buff.BuffId); if (oldBuff != null) { // 如果这个buff的特效还在加载,就先不播放了 if (oldBuff.State == BuffState.LoadingEffect) { return; } var effects = oldBuff.EffectRef; // 如果这个buff的特效还没有结束,就不用播放这个特效了 for (var i = 0; i < effects.Count; i++) { if (EffectManager.Instance.HasEffect(effects[i].Uuid)) { return; } } for (var i = 0; i < oldBuff.EffectId.Count; i++) { if (EffectManager.Instance.HasEffect(oldBuff.EffectId[i])) { return; } } if (record.Sound != -1) { if (oldBuff.SoundId > 0) { SoundManager.Instance.StopSoundEffectByTag(oldBuff.SoundId); SoundManager.Instance.PlaySoundEffect(record.Sound, 1.0f, oldBuff.SoundId, isSelfCast); } else { oldBuff.SoundId = SoundManager.NextTag; SoundManager.Instance.PlaySoundEffect(record.Sound, 1.0f, oldBuff.SoundId, isSelfCast); } } } else { SoundManager.Instance.PlaySoundEffect(record.Sound, 1, 0, isSelfCast); } var __array3 = record.Effect; var __arrayLength3 = __array3.Length; for (var __i3 = 0; __i3 < __arrayLength3; ++__i3) { var effect = __array3[__i3]; { if (effect == -1) { continue; } var tableData = Table.GetEffect(effect); if (tableData != null) { Vector3?pos = null; if (buff.Param.Count == 6) { var x = buff.Param[1] / 100.0f; var z = buff.Param[2] / 100.0f; var y = GameLogic.GetTerrainHeight(x, z); pos = new Vector3(x, y, z); } EffectManager.Instance.CreateEffect(tableData, character, pos, null, null, (tableData.BroadcastType == 0 && showCameraShake) || tableData.BroadcastType == 1); } } } } } break; case BuffType.HT_NODAMAGE: break; case BuffType.HT_Fire_DAMAGE: break; case BuffType.HT_Ice_DAMAGE: break; case BuffType.HT_Poison_DAMAGE: break; case BuffType.HT_MOVE: { if (buff.Param[3] > 0) { character.StartCoroutine(WaitToDoSomething(TimeSpan.FromMilliseconds(buff.Param[3]), () => { character.ForceMoveTo(buff.Param[0] / 1000.0f, buff.Param[1] / 1000.0f, buff.Param[2]); })); } else { character.ForceMoveTo(buff.Param[0] / 1000.0f, buff.Param[1] / 1000.0f, buff.Param[2]); } } break; case BuffType.HT_MANA: break; case BuffType.HT_REBOUND: break; default: throw new ArgumentOutOfRangeException(); } }
public void NotifyUseSkill(CharacterUseSkillMsg msg) { if (ObjManager.Instance == null) { Logger.Log2Bugly(" ObjManager.Instance =null"); return; } if (msg == null || msg.Pos == null || msg.Pos.Pos == null) { Logger.Log2Bugly("NotifyUseSkill msg =null"); return; } var chararcter = ObjManager.Instance.FindCharacterById(msg.CharacterId); if (null == chararcter) { Logger.Warn("NotifyUseSkill Cannot find obj[{0}]", msg.CharacterId); return; } if (chararcter.Dead) { return; } //放技能时的坐标 var p = GameLogic.GetTerrainPosition(GameUtils.DividePrecision(msg.Pos.Pos.x), GameUtils.DividePrecision(msg.Pos.Pos.y)); //放技能时的朝向 var dir = new Vector3(GameUtils.DividePrecision(msg.Pos.Dir.x), 0, GameUtils.DividePrecision(msg.Pos.Dir.y)); //如果距离差距过大就直接拉过来 var diff = (chararcter.Position.xz() - p.xz()).magnitude; ObjCharacter mainTargetCharacter = null; if (chararcter.GetObjType() == OBJ.TYPE.MYPLAYER) { PlatformHelper.Event("Skill", "Auto", msg.SkillId); //调整位置 if (diff > GameSetting.Instance.MainPlayerSkillPosErrorDistance) { chararcter.Position = p; } //调整朝向 chararcter.TargetDirection = dir; { var __list1 = msg.TargetObjId; var __listCount1 = __list1.Count; for (var __i1 = 0; __i1 < __listCount1; ++__i1) { var id = __list1[__i1]; { var target = ObjManager.Instance.FindCharacterById(id); if (null != target) { mainTargetCharacter = target; break; } } } } } else { if (chararcter.GetObjType() == OBJ.TYPE.OTHERPLAYER) { if (diff > GameSetting.Instance.OtherPlayerSkillPosErrorDistance) { chararcter.Position = p; } } else { if (diff > GameSetting.Instance.NPCSkillPosErrorDistance) { chararcter.DelayedMove = p; } } var adjustDir = false; { var __list2 = msg.TargetObjId; var __listCount2 = __list2.Count; for (var __i2 = 0; __i2 < __listCount2; ++__i2) { var id = __list2[__i2]; { var target = ObjManager.Instance.FindCharacterById(id); if (null != target) { mainTargetCharacter = target; chararcter.Target = target; if (chararcter.GetObjType() == OBJ.TYPE.NPC) { if (((ObjNPC)chararcter).CanFaceToTarget()) { chararcter.FaceTo(target.Position); } } else { chararcter.FaceTo(target.Position); } adjustDir = true; break; } } } } if (!adjustDir) { chararcter.TargetDirection = dir; } } var skillData = Table.GetSkill(msg.SkillId); if (null == skillData) { Logger.Fatal("Can't find skill[{0}]", msg.SkillId); return; } //放技能 chararcter.UseSkill(skillData, msg.TargetObjId); if (chararcter.GetObjType() == OBJ.TYPE.MYPLAYER) { var e = new SkillReleaseNetBack(skillData.Id, true); EventDispatcher.Instance.DispatchEvent(e); } if (ObjManager.Instance.MyPlayer == null) { Logger.Log2Bugly("ObjManager.Instance.MyPlayer == null"); return; } if (msg.CharacterId != ObjManager.Instance.MyPlayer.GetObjId() && msg.TargetObjId.Contains(ObjManager.Instance.MyPlayer.GetObjId())) { PlayerDataManager.Instance.SetSelectTargetData(chararcter, 1); } if (msg.CharacterId == ObjManager.Instance.MyPlayer.GetObjId() && ObjManager.Instance.MyPlayer != mainTargetCharacter && mainTargetCharacter != null && mainTargetCharacter.Dead == false) { PlayerDataManager.Instance.SetSelectTargetData(mainTargetCharacter, 2); } //Logger.Info("NotifyUseSkill Obj[{0}] skill[{1}]", msg.CharacterId, msg.SkillId); }
public override void OnSkillTest() { GameLogic.Get().m_currentScenario.m_skillTest.WillpowerTest(3, null); }
// Start is called before the first frame update void Start() { gameLogic = GameObject.Find("GameLogic").GetComponent <GameLogic>(); this.GetComponent <Image>().enabled = false; }
protected override void TriggerEnter(EntityBase entity) { int num = -((int)(base.m_Entity.m_EntityData.GetAttack(20) * base.args[0])); GameLogic.SendHit_Body(entity, base.m_Entity, (long)num, 0x3e8fa1); }
public ActionResult Reiniciar() { GameLogic.ReiniciarJogo(); return(RedirectToAction("Simulador")); }
protected override void OnDeadAction(EntityBase deadentity, EntityPartBodyBase partbody) { Vector3 pos = base.m_Entity.position + new Vector3(GameLogic.Random((float)-2f, (float)2f), 0f, GameLogic.Random((float)-2f, (float)2f)); if (partbody != null) { partbody.SetPosition(pos); base.m_Entity.AddRotateFollow(partbody); } }
/// <summary> /// Throws the dice /// </summary> /// <param name="logic">Logic of the game</param> /// <param name="player">Data of the player</param> /// <param name="action">Action player</param> public override void Invoke(GameLogic logic, Player player, PlayerAction action) { Dice.ThrowDice(); ClassLogger.Debug($"Dice thrown: {Dice.DiceState.CurrentDiceValue}"); }
public override void onUse() { GameLogic.LoadLevel("Level0", UnityEngine.SceneManagement.LoadSceneMode.Single); }
void Start() { _gameLogic = new GameLogic(); }
public void UpgradeCost() { _currentCost = Mathf.CeilToInt(upgradeInfo.cost * GameLogic.GetInstance().UpgradeManager().GetInflation()); costText.text = _currentCost.ToString(); }
private int GetWeightFunctionValue(IPlayer currentPlayer, GameLogic gameLogic, GameLogic oldLogic) { IPlayer player, enemy; if (currentPlayer.Equals(oldLogic.Player1)) { player = oldLogic.Player1; enemy = oldLogic.Player2; } else { player = oldLogic.Player2; enemy = oldLogic.Player1; } return(gameLogic[player, CellsCount] - gameLogic[enemy, CellsCount]); }
// Use this for initialization void Start() { gamelogic = GameObject.Find("Main Camera").GetComponent <GameLogic>(); somTronco = GameObject.Find("Main Camera").GetComponents <AudioSource>(); }
protected override void OnUseSkill() { GameLogic.SendBuff(base.m_Entity, 0x403, Array.Empty <float>()); }
// Use this for initialization void Start() { logicScript = GameObject.Find("GameLogic").GetComponent <GameLogic>(); }
private void Move2Player() { Vector2 vector2 = new Vector2((base.m_Entity.m_HatredTarget.position.x - base.m_Entity.position.x) + GameLogic.Random((float)-2f, (float)2f), (base.m_Entity.m_HatredTarget.position.z - base.m_Entity.position.z) + GameLogic.Random((float)-2f, (float)2f)); Vector2 normalized = vector2.normalized; this.Move_NextX = normalized.x; this.Move_NextY = normalized.y; if (normalized == Vector2.zero) { Vector2 vector8 = new Vector2(GameLogic.Random((float)-1f, (float)1f), GameLogic.Random((float)-1f, (float)1f)); Vector2 vector7 = vector8.normalized; this.Move_NextX = vector7.x; this.Move_NextY = vector7.y; } }
void Start() { gameLogic = FindObjectOfType <GameLogic>(); Request(); }
public void OnPointerEnter(PointerEventData eventData) { GameLogic.GetInstance().PlayHoverAudio(); }
public CollisionCallbackFinal(GameLogic logica, Play play) { this.logica = logica; this.play = play; }
/// <summary> /// Initializes a new instance of the <see cref="ControlExtension"/> class. /// </summary> /// <param name="logic">GameLogic instance. </param> public ControlExtension(GameLogic logic) { this.gameLogic = logic; }
private void ShowSkillIndicator(BuffResult buff, ObjCharacter character) { var skillId = buff.Param[0]; var data = Table.GetSkill(skillId); if (data == null) { Logger.Log2Bugly("ShowSkillIndicator data =null"); return; } if (GameLogic.Instance == null || GameLogic.Instance.Scene == null) { Logger.Log2Bugly("ShowSkillIndicator GameLogic.Instance =null"); return; } //SkillTargetType targetType = (SkillTargetType)data.TargetType; var targetType = (SkillTargetType)ObjMyPlayer.GetSkillData_Data(data, eModifySkillType.TargetType); if (targetType == SkillTargetType.CIRCLE) { // correct the direction of npc or monster. character.TargetDirection = new Vector3(buff.Param[3] / 1000.0f, 0, buff.Param[4] / 1000.0f); var para0 = ObjMyPlayer.GetSkillData_Data(data, eModifySkillType.TargetParam1); GameLogic.Instance.Scene.CreateSkillRangeIndicator(character.gameObject, Scene.SkillRangeIndicatorType.Circle, para0, 0, Color.black, (caster, receiver) => { StartCoroutine(WaitToDoSomething(TimeSpan.FromMilliseconds(buff.Param[5]), () => { Destroy(caster); Destroy(receiver); })); }, true, buff.Param[5] * 0.001f); } else if (targetType == SkillTargetType.SECTOR || targetType == SkillTargetType.TARGET_SECTOR) { // correct the direction of npc or monster. character.TargetDirection = new Vector3(buff.Param[3] / 1000.0f, 0, buff.Param[4] / 1000.0f); GameLogic.Instance.Scene.CreateSkillRangeIndicator(character.gameObject, Scene.SkillRangeIndicatorType.Fan, data.TargetParam[0], data.TargetParam[1], Color.black, (caster, receiver) => { StartCoroutine(WaitToDoSomething(TimeSpan.FromMilliseconds(buff.Param[5]), () => { Destroy(caster); Destroy(receiver); })); }, true, buff.Param[5] * 0.001f); } else if (targetType == SkillTargetType.RECT || targetType == SkillTargetType.TARGET_RECT) { // correct the direction of npc or monster. character.TargetDirection = new Vector3(buff.Param[3] / 1000.0f, 0, buff.Param[4] / 1000.0f); GameLogic.Instance.Scene.CreateSkillRangeIndicator(character.gameObject, Scene.SkillRangeIndicatorType.Rectangle, data.TargetParam[0], data.TargetParam[1], Color.black, (caster, receiver) => { StartCoroutine(WaitToDoSomething(TimeSpan.FromMilliseconds(buff.Param[5]), () => { Destroy(caster); Destroy(receiver); })); }, true, buff.Param[5] * 0.001f); } else if (targetType == SkillTargetType.SINGLE || targetType == SkillTargetType.TARGET_CIRCLE) { var x = buff.Param[1] / 100.0f; var z = buff.Param[2] / 100.0f; var y = GameLogic.GetTerrainHeight(x, z); var o = new GameObject(); var objTransform = o.transform; objTransform.parent = GameLogic.Instance.Scene.GlobalSkillIndicatorRoot.transform; objTransform.position = new Vector3(x, y, z); objTransform.forward = new Vector3(buff.Param[3] / 1000.0f, 0, buff.Param[4] / 1000.0f); if (targetType == SkillTargetType.TARGET_CIRCLE) { GameLogic.Instance.Scene.CreateSkillRangeIndicator(o, Scene.SkillRangeIndicatorType.Circle, data.TargetParam[0], 0, Color.black, (caster, receiver) => { StartCoroutine(WaitToDoSomething(TimeSpan.FromMilliseconds(buff.Param[5]), () => { Destroy(o); })); }, true, buff.Param[5] * 0.001f); } else if (targetType == SkillTargetType.TARGET_SECTOR) { GameLogic.Instance.Scene.CreateSkillRangeIndicator(o, Scene.SkillRangeIndicatorType.Fan, data.TargetParam[0], data.TargetParam[1], Color.black, (caster, receiver) => { var casterTransform = caster.transform; casterTransform.position = new Vector3(x, y, z); casterTransform.forward = new Vector3(buff.Param[3] / 1000.0f, 0, buff.Param[4] / 1000.0f); StartCoroutine(WaitToDoSomething(TimeSpan.FromMilliseconds(buff.Param[5]), () => { Destroy(o); })); }, true, buff.Param[5] * 0.001f); } else if (targetType == SkillTargetType.TARGET_RECT) { GameLogic.Instance.Scene.CreateSkillRangeIndicator(o, Scene.SkillRangeIndicatorType.Rectangle, data.TargetParam[0], data.TargetParam[1], Color.black, (caster, receiver) => { var casterTransform = caster.transform; casterTransform.position = new Vector3(x, y, z); casterTransform.forward = new Vector3(buff.Param[3] / 1000.0f, 0, buff.Param[4] / 1000.0f); StartCoroutine(WaitToDoSomething(TimeSpan.FromMilliseconds(buff.Param[5]), () => { Destroy(o); })); }, true, buff.Param[5] * 0.001f); } } }
void Start() { MyGameLogic = GameObject.Find("GameLogic").GetComponent <GameLogic> (); Reset(); }
private void OnMiss() { GameLogic.SendBuff(base.m_Entity, base.m_Entity, this.buffid, Array.Empty <float>()); }
/// <summary> /// Updates the list of valid moves based on the last selected starting position. /// </summary> /// <param name="startPosition">Start position of the moves</param> public void UpdateValidDestinies(Position startPosition) { lastValidDestinies = GameLogic.GetValidDestinies(this, startPosition); }
void OnClick() { GameLogic.GetInstance().PlayClickAudio(); }
public void createNewBalloon() { GameLogic.AddScore(1); createBalloon(); }
/// <summary> /// Every object must have this method, but not every phys object must necessarily have something to cleanup /// <remarks> /// </remarks> /// </summary> public void Delete() { Close(); BeforeDelete(); GameLogic.Close(); //doesnt work in parallel update //Debug.Assert(MySandboxGame.IsMainThread(), "Entity.Close() called not from Main Thread!"); Debug.Assert(MyEntities.UpdateInProgress == false, "Do not close entities directly in Update*, use MarkForClose() instead"); Debug.Assert(MyEntities.CloseAllowed == true, "Use MarkForClose()"); Debug.Assert(!Closed, "Close() called twice!"); //Children has to be cleared after close notification is send while (Hierarchy.Children.Count > 0) { MyHierarchyComponentBase compToRemove = Hierarchy.Children[Hierarchy.Children.Count - 1]; Debug.Assert(compToRemove.Parent != null, "Entity has no parent but is part of children collection"); compToRemove.Container.Entity.Delete(); Hierarchy.Children.Remove(compToRemove); } //OnPositionChanged = null; CallAndClearOnClosing(); MyDecals.RemoveModelDecals(this); MyEntities.RemoveName(this); MyEntities.RemoveFromClosedEntities(this); if (m_physics != null) { m_physics.Close(); Physics = null; RaisePhysicsChanged(); } MyEntities.UnregisterForUpdate(this, true); if (Parent == null) //only root objects are in entities list { MyEntities.Remove(this); } else { Parent.Hierarchy.Children.Remove(this.Hierarchy); //remove children first if (Parent.InScene) { OnRemovedFromScene(this); } MyEntities.RaiseEntityRemove(this); } if (this.EntityId != 0) { MyEntityIdentifier.RemoveEntity(this.EntityId); } //this.EntityId = 0; Debug.Assert(this.Hierarchy.Children.Count == 0); CallAndClearOnClose(); Components.Clear(); ClearDebugRenderComponents(); Closed = true; }
public void Initialize() { _game = new GameLogic(); _game.StartGame(1, 25); }