private void Start() { if (_gameplayController == null) { _gameplayController = GameObject.FindWithTag("Mechanism").GetComponent <GameplayController>(); } }
private void DiceTable(GameplayController gameplayController) { diceOpen = EditorGUILayout.BeginFoldoutHeaderGroup(diceOpen, "DICE"); if (diceOpen) { RandomDice dice = gameplayController.board.dice; GUILayout.BeginHorizontal(); GUILayout.Label("Round", GUILayout.Width(40f)); GUILayout.Label("Current Player", GUILayout.Width(100f)); GUILayout.Label("Amount of rolls", GUILayout.Width(100f)); GUILayout.Label("Last1", GUILayout.Width(100f)); GUILayout.Label("Last2", GUILayout.Width(100f)); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label(dice.round.ToString(), GUILayout.Width(40f)); GUILayout.Label(gameplayController.session.FindPlayer(dice.currentPlayer).GetName(), GUILayout.Width(100f)); GUILayout.Label(dice.amountOfRolls.ToString(), GUILayout.Width(100f)); GUILayout.Label(dice.last1.ToString(), GUILayout.Width(100f)); GUILayout.Label(dice.last2.ToString(), GUILayout.Width(100f)); GUILayout.EndHorizontal(); } EditorGUILayout.EndFoldoutHeaderGroup(); }
void MakeInstance() { if (instance == null) { instance = this; } }
public void CompleteAct() { if (PF_GamePlay.QuestProgress != null) { //this.gameplayController.directionController; PF_GamePlay.QuestProgress.CurrentAct.Value.IsActCompleted = true; if (PF_GamePlay.encounters.Count > 1) { // more acts to go GameplayController.RaiseGameplayEvent(GlobalStrings.ACT_COMPLETE_EVENT, PF_GamePlay.GameplayEventTypes.OutroAct); } else { // no more acts, complete quest PF_GamePlay.QuestProgress.isQuestWon = true; UB_GamePlayEncounter topOfStack = new UB_GamePlayEncounter(); topOfStack = PF_GamePlay.encounters.First(); PF_GamePlay.QuestProgress.CompletedEncounters.Add(topOfStack); PF_GamePlay.encounters.Remove(PF_GamePlay.encounters.First()); //CycleNextEncounter(); GameplayController.RaiseGameplayEvent(GlobalStrings.QUEST_COMPLETE_EVENT, PF_GamePlay.GameplayEventTypes.OutroQuest); } } }
public IEnumerator Spin() { titleAnimator.PlayForward(); descriptionAnimator.PlayForward(); startTime = Time.time; while (startTime + waitTime > Time.time) { yield return(new WaitForEndOfFrame()); } descriptionAnimator.PlayReverse(); StartCoroutine(PF_GamePlay.Wait(.55f, () => { titleAnimator.PlayReverse(); PF_GamePlay.OutroPane(gameObject, .5f); if (activeState == DisplayStates.PlayerDied) { ContinueToGameOver(); } else if (PF_GamePlay.UseRaidMode) { GameplayController.RaiseGameplayEvent(GlobalStrings.QUEST_COMPLETE_EVENT, PF_GamePlay.GameplayEventTypes.OutroQuest); } else { StartQuest(); } })); }
public void CycleNextEncounter() { this.currentEncounter = GetNextEncounter(); if (this.currentEncounter != null) { UnityAction callback = () => { UnityAction afterTransition = () => { if (this.currentEncounter.Data.EncounterType.ToString().Contains(GlobalStrings.ENCOUNTER_CREEP) && this.currentPlayer.PlayerVitals.Speed * 1.5f < this.currentEncounter.Data.Vitals.Speed) { this.CurrentTurn = PF_GamePlay.TurnStates.Enemy; gameplayController.EnemyAttackPlayer(true); this.gameplayController.playerController.EncounterBar.EnableEncounterOptions(this.currentEncounter.Data.EncounterType, this.currentEncounter.DisplayName, true); } else { this.CurrentTurn = PF_GamePlay.TurnStates.Player; //this.gameplayController.playerController.EncounterBar.EnableEncounterOptions(this.currentEncounter.Data.EncounterType, this.currentEncounter.DisplayName); this.gameplayController.playerController.TransitionActionBarIn(); } GameplayController.RaiseGameplayEvent(GlobalStrings.NEXT_ENCOUNTER_EVENT, PF_GamePlay.GameplayEventTypes.IntroEncounter); }; this.gameplayController.enemyController.currentEncounter.UpdateCurrentEncounter(this.currentEncounter); this.gameplayController.enemyController.nextController.UpdateNextEncounters(); this.gameplayController.enemyController.TransitionCurrentEncounterIn(afterTransition); }; this.gameplayController.enemyController.TransitionCurrentEncounterOut(callback); } }
public void ToggleTurn(PF_GamePlay.TurnStates forceTurn = PF_GamePlay.TurnStates.Null) { if (forceTurn != PF_GamePlay.TurnStates.Null) { if (forceTurn == PF_GamePlay.TurnStates.Player) { this.CurrentTurn = PF_GamePlay.TurnStates.Player; GameplayController.RaiseGameplayEvent(GlobalStrings.PLAYER_TURN_BEGIN_EVENT, PF_GamePlay.GameplayEventTypes.PlayerTurnBegins); } else if (forceTurn == PF_GamePlay.TurnStates.Enemy) { this.CurrentTurn = PF_GamePlay.TurnStates.Enemy; GameplayController.RaiseGameplayEvent(GlobalStrings.ENEMY_TURN_BEGIN_EVENT, PF_GamePlay.GameplayEventTypes.EnemyTurnBegins); } return; } if (this.CurrentTurn == PF_GamePlay.TurnStates.Player) { this.CurrentTurn = PF_GamePlay.TurnStates.Enemy; GameplayController.RaiseGameplayEvent(GlobalStrings.ENEMY_TURN_BEGIN_EVENT, PF_GamePlay.GameplayEventTypes.EnemyTurnBegins); } else if (this.CurrentTurn == PF_GamePlay.TurnStates.Enemy) { this.CurrentTurn = PF_GamePlay.TurnStates.Player; GameplayController.RaiseGameplayEvent(GlobalStrings.PLAYER_TURN_BEGIN_EVENT, PF_GamePlay.GameplayEventTypes.PlayerTurnBegins); } }
public void Spawn() { if (!GameplayController.CanUpdate() || cooling || resources.current < 10) { return; } //pick a spawner int idx = Random.Range(0, 3); Vector3 spawnPos = spawners [idx].position; GameObject newUnit = Instantiate(unitPref) as GameObject; newUnit.transform.SetParent(unitsContainer); newUnit.transform.position = spawnPos; newUnit.transform.localScale = Vector3.one; //if autopilot on, pick an order if (autoPilot) { int order = resources.current <= 15 ? UnitController.COLLECT : Random.Range(0, 3); newUnit.SendMessage("SetOrder", order); } cooling = true; resources.current -= 10; }
public void Init(GameplayController gameplayController, Player player, int x, int y) { _gameplayController = gameplayController; _cellCoords = new Vector2Int(x, y); Button.onClick.AddListener(() => gameplayController.MakeTurn(player.PlayerSide, x, y)); }
public void Init() { line = GetComponent <LineRenderer>(); line.enabled = false; player = PlayerController.Instance; endLinePosition = player.transform.position; startLinePosition = player.transform.position; hitPoint = player.transform.position; line.startWidth = line.endWidth = defaultLineWidth; objectSpawner = ObjectSpawner.Instance; gameplayController = GameplayController.Instance; line.startWidth = line.endWidth = 0; locktaskpanel = FindObjectOfType <LockTaskPanel>(); isInit = true; }
// Click handler for action public void OnMouseDown() { int manaCost = GameplayController.getGameplayOptions().extinguishManaCost; GameActor player = GameplayController.getPlayer(); // Checking if action should be performed if (GameplayController.getCurrentAction() == GameplayController.PlayerAction.EXTINGUISH_ACTION) { // Checking available mana and extinguish status if (player.getMana() < manaCost || extinguished || player.getHealth() < 0.1f) { return; } // Disabling collider Collider2D attachedCollider = GetComponent <Collider2D>(); if (attachedCollider) { attachedCollider.enabled = false; Debug.Log("YAK"); } extinguished = true; SpriteRenderer spriteRenderer = GetComponent <SpriteRenderer>(); if (spriteRenderer) { spriteRenderer.enabled = false; } // Spending mana from player mana pool player.setMana(player.getMana() - manaCost); } }
void SetInstance() { if (instance == null) { instance = this; } }
public override void Handle() { GDebug.Log("GameplayState Start", this, LogCategory.STATE_MACHINE); _controller = _factory.Create(); _controller.Initialization(); }
void Start() { // Initialize the controller GameObject controllerInstance = GameObject.FindGameObjectWithTag(TagsConst.GameController); controller = controllerInstance.GetComponent <GameplayController>(); }
public override void Init(GameState s, GameplayController c, object args) { state = s; initArgs = args == null ? null : args as AnimationInitArgs; if (initArgs == null) { initArgs = AnimationInitArgs.Default; } alRest = new AnimationLoop(initArgs.Splices[0].X, initArgs.Splices[0].Y); alRest.FrameSpeed = initArgs.Speeds[0]; alWalk = new AnimationLoop(initArgs.Splices[1].X, initArgs.Splices[1].Y); alWalk.FrameSpeed = initArgs.Speeds[1]; alMelee = new AnimationLoop(initArgs.Splices[2].X, initArgs.Splices[2].Y); alMelee.FrameSpeed = initArgs.Speeds[2]; alPrepareFire = new AnimationLoop(initArgs.Splices[3].X, initArgs.Splices[3].Y); alPrepareFire.FrameSpeed = initArgs.Speeds[3]; alFire = new AnimationLoop(initArgs.Splices[4].X, initArgs.Splices[4].Y); alFire.FrameSpeed = initArgs.Speeds[4]; alDeath = new AnimationLoop(initArgs.Splices[5].X, initArgs.Splices[5].Y); alDeath.FrameSpeed = initArgs.Speeds[5]; SetAnimation(BehaviorFSM.None); System.Threading.Interlocked.Exchange(ref isInit, 1); }
// Click handler for action public void OnMouseDown() { int manaCost = GameplayController.getGameplayOptions().healManaCost; int healValue = GameplayController.getGameplayOptions().healValue; GameActor player = GameplayController.getPlayer(); // Checking if action should be performed if (GameplayController.getCurrentAction() == GameplayController.PlayerAction.HEAL_ACTION) { // Checking available mana and health condition if (player.getMana() < manaCost || player.getHealth() < 0.1f) { return; } // Starting animation player.doCastAnimation(); // Increasing actor health GameActor actor = GetComponentInParent <GameActor>(); if (actor.getHealth() >= 1.0f) { actor.setHealth(actor.getHealth() + healValue); } // Instantiating effect Instantiate(healEffect, actor.transform); } // Spending mana from player mana pool player.setMana(player.getMana() - manaCost); }
// Click handler for action public void OnMouseDown() { int manaCost = GameplayController.getGameplayOptions().lightManaCost; GameActor player = GameplayController.getPlayer(); // Checking if action should be performed if (GameplayController.getCurrentAction() == GameplayController.PlayerAction.LIGHT_ACTION) { // Checking available mana and unlock status if (player.getMana() < manaCost || lighted || player.getHealth() < 0.1f) { return; } // Disabling collider Collider attachedCollider = GetComponent <Collider>(); if (attachedCollider) { attachedCollider.enabled = false; } lighted = true; // Change sprite SpriteRenderer renderer = GetComponent <SpriteRenderer>(); renderer.color = new Color(1.0f, 1.0f, 1.0f, 0.1f); // Spending mana from player mana pool player.setMana(player.getMana() - manaCost); } }
public override void UpdateEnd() { Units.RemoveAll(o => o.Destroyed); /* * if (Input.KeyboardCheckPress(Microsoft.Xna.Framework.Input.Keys.W)) * { * // TODO: Remove! * _win = true; * } * * if (Input.KeyboardCheckPress(Microsoft.Xna.Framework.Input.Keys.L)) * { * // TODO: Remove! * _lose = true; * }*/ if (_win) { UnitTurnOrderList[CurrentUnit].Initiative = false; if (_winDialogue == null) { SoundController.CurrentSong.Stop(); WinSound = SoundController.PlaySound(SoundController.Win); _winDialogue = new Dialogue(new string[] { "" }, new string[] { Strings.BattleWin }); _winDialogue.Locked = true; } else { if (!WinSound.IsPlaying) { Objects.Destroy(_winDialogue); Objects.Destroy(this); } } } ArenaPlayer player = (ArenaPlayer)Objects.ObjFind <ArenaPlayer>(0); if (_lose) { _blackscreenActivated = true; SoundController.CurrentSong.Volume = 1 - Math.Max(0, Math.Min(1, _blackscreenAlpha)); if (_loseDialogue == null) { _loseDialogue = new Dialogue(new string[] { "" }, new string[] { Strings.BattleDefeat }); } else { if (_loseDialogue.Destroyed) { Objects.Destroy(this); GameplayController.LoadGame(); } } } }
private void Start() { scoreUpdater = scoreCounterObject.GetComponent <UpdateScore>(); gameOverScreen = gameOverScreenObject.GetComponent <GameOverScreen>(); gController = GameObject.FindGameObjectWithTag(Tags.GameController).GetComponent <GameplayController>(); playerSoundSrc = GetComponent <AudioSource>(); spriteRenderer = GetComponent <SpriteRenderer>(); bScroller = GameObject.FindGameObjectWithTag(Tags.GameController).GetComponent <BlockScroller>(); //Find out which joysticks we have connected, if any string[] controllers = Input.GetJoystickNames(); foreach (string controller in controllers) { Debug.Log(controller); if (controller.Contains("Xbox")) { UsingXBoneController = true; } if (controller.Contains("PLAYSTATION")) { Debug.Log("Detected PS3 Controller"); UsingPS3Controller = true; } } }
// Use this for initialization void Start() { needUpdateBoard = true; needUpdateMoving = true; _gameplayController = GameObject.FindObjectOfType <GameplayController>(); }
void MakeSingleton() { if (instance == null) { instance = this; } }
// Click handler for action public void OnMouseDown() { Debug.Log("Move"); int manaCost = GameplayController.getGameplayOptions().levitateManaCost; GameActor player = GameplayController.getPlayer(); // Checking if action should be performed if (GameplayController.getCurrentAction() == GameplayController.PlayerAction.LEVITATE_ACTION) { // Checking available mana and move status if (player.getMana() < manaCost || moving || player.getHealth() < 0.1f) { return; } // Initiating move moveRemaining = GameplayController.getGameplayOptions().levitateStepCount; moveCounter++; moving = true; // Spending mana from player mana pool player.setMana(player.getMana() - manaCost); } }
public void Attach(GameplayController gameplayController, CardController cardController, DoorController doorController, Camera mainCamera) { this.gameplayController = gameplayController; this.cardController = cardController; this.doorController = doorController; this.mainCamera = mainCamera; }
void Awake() { if (instance == null) { instance = this; } }
void CreateInstance() { if (instance == null) { instance = this; } }
public override void Init(GameState s, GameplayController c, object args) { ButtonQueue = new Queue <ACBuildingButtonController>(); QueueTimer = float.MaxValue; CurrentButton = null; QueueCap = 5; }
void ExtractResource(GameObject tower) { if (GameplayController.CanUpdate() && health > 0) { tower.SendMessage("ModifyResources", 2); } }
void createInstance() { if (gameplayController == null) { gameplayController = this; } }
void Start() { menu = FindObjectOfType <Menu>(); settingPanel = FindObjectOfType <SettingPanel>(); gameplayController = GameplayController.Instance; levelController = LevelController.Instance; child = transform.GetChild(0); screen = canvasRect.rect.width; child.gameObject.SetActive(true); index = GameplayController.LevelIndex; range = -index * registerdscreen; targetPosition = range; childPosition.x = screen; child.localPosition = childPosition; }
public override void Init(GameState s, GameplayController c) { ActivityInterval = 10; ExtractAmount = 10; currTime = 0; Enabled = true; }
private void Awake() { gameplayInstance = GameplayController.Instance; playerDependend = GetComponentsInChildren<IUIFromPlayer>(); gameplayInstance.OnPlayerSpawnEvent += OnPlayerSpawn; }
private void Awake() { gameplayController = GameplayController.Instance; }
private void Awake() { gameplayController = GameplayController.Instance; gameplayController.GameStartedEvent += OnGameStarted; spawners = GetComponentsInChildren<EnemySpawner>(); }
void MakeInstance(){ if(instance == null){ instance = this; } }
void OnEnable() { //---> Création du singleton if (Instance == null) Instance = this; }
void Start() { m_controller = GameObject.Find("Root").GetComponent<GameplayController>(); m_controller.InAsteroids = true; m_emitter = ParticleEmitter.GetComponent<ParticleSystem>(); m_spaceships = new GameObject[] { TopLeftSpaceship, TopRightSpaceship, MiddleSpaceship, BottomLeftSpaceship, BottomRightSpaceship }; ShuffleArray(); m_spaceships[0].transform.position = s_topLeftAwayPosition; m_spaceships[0].transform.rotation = Quaternion.Euler(s_topLeftAwayRotation); m_spaceships[1].transform.position = s_topRightAwayPosition; m_spaceships[1].transform.rotation = Quaternion.Euler(s_topRightAwayRotation); m_spaceships[2].transform.position = s_middleAwayPosition; m_spaceships[2].transform.rotation = Quaternion.Euler(s_middleAwayRotation); m_spaceships[3].transform.position = s_bottomLeftAwayPosition; m_spaceships[3].transform.rotation = Quaternion.Euler(s_bottomLeftAwayRotation); m_spaceships[4].transform.position = s_bottomLeftAwayPosition; m_spaceships[4].transform.rotation = Quaternion.Euler(s_bottomLeftAwayRotation); // Landing var time = Time.realtimeSinceStartup; MoveToTopLeftDock(m_spaceships[0], time); MoveToTopRightDock(m_spaceships[1], time); MoveToMiddle(m_spaceships[2], time); MoveToBottomLeftDock(m_spaceships[3], time); MoveToBottomRightDock(m_spaceships[4], time); m_animations.Add(new ActionAnimation(() => { m_controller.InAsteroids = false; }, time + 2.5f)); PrepareNextAsteroids(time + 25f); }