public PutObjectExtra ( string paramName, object value ) : void | ||
paramName | string | |
value | object | |
return | void |
public override void Execute() { List <ControllableUnit> teamAList = BattleComposition.Instance.GetAllTeamAUnits(); List <ControllableUnit> teamBList = BattleComposition.Instance.GetAllTeamBUnits(); foreach (ControllableUnit unit in teamAList) { Vector3 unitScreenPos = Camera.main.WorldToViewportPoint(unit.transform.position); Parameters parameters = new Parameters(); parameters.PutObjectExtra(GameHUDScreen.UNIT_POSITION_KEY, unitScreenPos); parameters.PutObjectExtra(GameHUDScreen.CONTROLLABLE_UNIT_KEY, unit); EventBroadcaster.Instance.PostEvent(EventNames.ON_RETRIEVE_UNIT_POSITION, parameters); } foreach (ControllableUnit unit in teamBList) { Vector3 unitScreenPos = Camera.main.WorldToViewportPoint(unit.transform.position); Parameters parameters = new Parameters(); parameters.PutObjectExtra(GameHUDScreen.UNIT_POSITION_KEY, unitScreenPos); parameters.PutObjectExtra(GameHUDScreen.CONTROLLABLE_UNIT_KEY, unit); EventBroadcaster.Instance.PostEvent(EventNames.ON_RETRIEVE_UNIT_POSITION, parameters); } }
public void PlayFlyAnimation() { EventBroadcaster.Instance.PostEvent(EventNames.HA); const float MIN = -10; const float MAX = 10; Parameters p = new Parameters(); p.PutObjectExtra(Player.SERVED_CUSTOMER_KEY, this); p.PutObjectExtra(Player.SERVED_DIR_CUSTOMER_KEY, this.GetDirection()); EventBroadcaster.Instance.PostEvent(EventNames.ON_HIT_CUSTOMER, p); // Update sprite this.GetComponent <SpriteRenderer>().sprite = enemyClass.HitSprite; var endPosition = GameManager.Instance.GetSpawnPointPosition(this.GetDirection()); endPosition.x *= 1.5f; endPosition.y *= 1.5f; endPosition.y += GetRandomNumber(MIN, MAX); endPosition.x += GetRandomNumber(MIN, MAX); // Change angle based on new position this.transform.DORotate(new Vector3(0f, 0f, this.transform.localPosition.AngleBetweenVector(endPosition)), this.flyAnimationSpeed / 2); this.transform.localScale = new Vector3(1.5f, 1.5f, 1.5f); // Change position on fly this.transform.DOMove(endPosition, this.flyAnimationSpeed) .SetEase(Ease.OutExpo); }
public override void Execute() { List<ControllableUnit> teamAList = BattleComposition.Instance.GetAllTeamAUnits(); List<ControllableUnit> teamBList = BattleComposition.Instance.GetAllTeamBUnits(); foreach(ControllableUnit unit in teamAList) { Vector3 unitScreenPos = Camera.main.WorldToViewportPoint(unit.transform.position); Parameters parameters = new Parameters(); parameters.PutObjectExtra(GameHUDScreen.UNIT_POSITION_KEY, unitScreenPos); parameters.PutObjectExtra(GameHUDScreen.CONTROLLABLE_UNIT_KEY, unit); EventBroadcaster.Instance.PostEvent(EventNames.ON_RETRIEVE_UNIT_POSITION, parameters); } foreach(ControllableUnit unit in teamBList) { Vector3 unitScreenPos = Camera.main.WorldToViewportPoint(unit.transform.position); Parameters parameters = new Parameters(); parameters.PutObjectExtra(GameHUDScreen.UNIT_POSITION_KEY, unitScreenPos); parameters.PutObjectExtra(GameHUDScreen.CONTROLLABLE_UNIT_KEY, unit); EventBroadcaster.Instance.PostEvent(EventNames.ON_RETRIEVE_UNIT_POSITION, parameters); } }
public void OnClicked() { this.assignedButton.interactable = false; this.ShowStep1(); this.ShowStep2(); Parameters parameters = new Parameters(); parameters.PutObjectExtra(GameMechanicHandler.PICTURE_MODEL_KEY, this.pictureModel); parameters.PutObjectExtra(GameMechanicHandler.PICTURE_MATCH_LISTENER_KEY, this); EventBroadcaster.Instance.PostEvent(EventNames.ON_PICTURE_CLICKED, parameters); }
/// <summary> /// Broadcasts ghost block related events. /// </summary> /// <param name="isAdd">If its change was an addition operation.</param> public void PostHollowBlockEventImmediate(bool isAdd) { //this.PostHollowBlockEvent(isAdd); Debug.Log("<color=cyan>POST HOLLOW EVENT IMMEDIATE " + isAdd + "</color>"); Parameters parameters = new Parameters(); parameters.PutExtra(StabilityNumberLine.NUMERATOR, this.GetNumerator()); parameters.PutExtra(StabilityNumberLine.DENOMINATOR, this.GetDenominator()); parameters.PutObjectExtra(StabilityNumberLine.COLOR, this.GetHighlightColor()); parameters.PutExtra(StabilityNumberLine.IS_ADD, isAdd); parameters.PutObjectExtra(StabilityNumberLine.HOLLOW_BLOCK, this); EventBroadcaster.Instance.PostEvent(EventNames.ON_HOLLOW_STABILITY_UPDATE_INSTANT, parameters); }
/// <summary> /// Function that handles the posting of a carry event. /// </summary> /// <param name="carriedPiece"></param> /// <returns></returns> public void PostCarryEvent(HollowBlock carriedPiece) { Parameters parameters = new Parameters(); parameters.PutObjectExtra(SkyFragmentPieceUI.HOLLOW_BLOCK, carriedPiece); EventBroadcaster.Instance.PostEvent(EventNames.ON_PLAYER_LIFT_CARRY, parameters); }
public void OnBuy() { CurrentlyBeingUsed = playerTypes [currentCounter]; if (playerTypes [currentCounter].locked == false) { this.OnPlay(); Parameters param = new Parameters(); param.PutObjectExtra(Player.PLAYER_TYPE_KEY, playerTypes [currentCounter]); EventBroadcaster.Instance.PostEvent(EventNames.ON_SET_PLAYERTYPE, param); } else { if (playerTypes [currentCounter].price <= GameManager.Instance.getEarnedGold()) { GameManager.Instance.setEarnedGold(GameManager.Instance.getEarnedGold() - playerTypes [currentCounter].price); playerTypes [currentCounter].locked = false; Parameters param = new Parameters(); param.PutObjectExtra(Player.PLAYER_TYPE_KEY, playerTypes [currentCounter]); EventBroadcaster.Instance.PostEvent(EventNames.ON_SET_PLAYERTYPE, param); this.OnPlay(); } } }
/// <summary> /// Posts a carry event. /// </summary> /// <param name="carriedPiece"></param> /// <returns></returns> public void PostCarryEvent(SkyFragmentPiece carriedPiece) { Parameters parameters = new Parameters(); parameters.PutObjectExtra(SkyFragmentPieceUI.SKY_PIECE, carriedPiece); EventBroadcaster.Instance.PostEvent(EventNames.ON_PLAYER_GEM_CARRY, parameters); }
private void Update() { if (!Input.anyKeyDown) { return; } var bottomBlock = BlockSpawner.Instance.GetBottomBlock(); if (bottomBlock == null) { return; } var parameters = new Parameters(); parameters.PutExtra(MatchHandler.PARAM_TARGETCOLOR, (int)bottomBlock.Color); var playerControls = new [] { keyRed, keyBlue, keyGreen }; for (var i = 0; i < playerControls.Length; i++) { if (!Input.GetKey(playerControls[i])) { continue; } parameters.PutObjectExtra(MatchHandler.PARAM_KEY_PRESSED, playerControls[i]); EventBroadcaster.Instance.PostEvent(EventNames.ON_BLOCKCLICK, parameters); break; } }
private void RequestSpawn() { // Get Random Direction var direction = GetRandomDirection(); // Get Enemy Class // TODO: Support multiple enemy class var enemyClass = this.enemyDatabase.GetEnemyClassList()[0]; // Request spawn from EnemySpawner var p = new Parameters(); p.PutObjectExtra(EnemySpawner.PARAM_DIRECTION, direction); p.PutObjectExtra(EnemySpawner.PARAM_ENEMYCLASS, enemyClass); EventBroadcaster.Instance.PostEvent(EventNames.ON_SPAWN_REQUEST, p); }
/// <summary> /// Post tracked hand image target event. /// </summary> public void PostTrackedHandEvent() { Debug.Log("<color=green>FOUND Hand Image Target</color>"); Parameters parameters = new Parameters(); parameters.PutObjectExtra(GameMaster.PLAYER, this.player); EventBroadcaster.Instance.PostEvent(EventNames.IMAGE_TARGETS.TRACKED_HAND, parameters); }
/// <summary> /// Damage the player life by 1. /// </summary> public void Damage() { this.SetLifeCount(this.GetLifeCount() - 1); Parameters parameters = new Parameters(); parameters.PutObjectExtra(LifeObject.PLAYER_REDUCED, this); //EventBroadcaster.Instance.PostEvent(EventNames.ARENA.REDUCE_HEALTH); EventBroadcaster.Instance.PostEvent(EventNames.ARENA.REDUCE_HEALTH, parameters); }
public void ActivateFrenzy() { ResetFrenzy(); var enemyList = EnemySpawner.Instance.GetEnemyList(); var p = new Parameters(); p.PutObjectExtra(EnemyMechanicHandler.PARAM_ENEMYLIST, enemyList); EventBroadcaster.Instance.PostEvent(EventNames.ON_FRENZY_ACTIVATED, p); }
public void SetPlayerTurn(PlayerManager newTurn) { playerTurn = newTurn; // Remove this on Multi-device MainScreenManager_GameScene.Instance.SetPlayer(playerTurn); this.hasVerifiedPlayer = false; Parameters param = new Parameters(); string playerName = playerTurn == player1 ? "Player 1's Turn" : "Player 2's Turn"; param.PutObjectExtra(RuleManager.RULE_PARAM, new RuleInfo(Rules.TEXT_ONLY, playerName)); EventBroadcaster.Instance.PostEvent(EventNames.UI.RULE_UPDATE, param); }
private static void SwipeCallback(Direction direction) { if (!GameManager.Instance.IsPlaying()) { return; } // Notify on swipe var parameters = new Parameters(); parameters.PutObjectExtra(EnemyMechanicHandler.PARAM_DIRECTION, direction); EventBroadcaster.Instance.PostEvent(EventNames.ON_SWIPE, parameters); }
/// <summary> /// Updates the health UI. /// </summary> /// <returns></returns> void UpdateHealthUI() { // Update Blue Bar Parameters parameters = new Parameters(); parameters.PutObjectExtra("playerHealth", this); EventBroadcaster.Instance.PostEvent(EventNames.ON_PLAYER_DAMAGE, parameters); // Update Text parameters = new Parameters(); parameters.PutExtra("currentHP", this.hp); parameters.PutExtra("maxHP", this.maxHp); EventBroadcaster.Instance.PostEvent(EventNames.ON_HEALTH_UPDATE, parameters); }
public void OnTrackableStateChanged(TrackableBehaviour.Status previousStatus, TrackableBehaviour.Status newStatus) { if (newStatus == Status.TRACKED) { this.tracked = true; Parameters parameters = new Parameters(); Vector3 trackedPos = this.TranslateBeaconPosition(); parameters.PutObjectExtra(BEACON_POSITION_KEY, trackedPos); EventBroadcaster.Instance.PostEvent(EventNames.ARPathFindEvents.ON_BEACON_DETECTED, parameters); } else if (newStatus == Status.NO_POSE) { this.tracked = false; } }
IEnumerator EndGamePhase(PlayerManager winner) { Debug.Log("<color=cyan> START: EndGame()</color>"); StopCoroutine(currentCoroutine); this.isPlaying = false; Parameters param = new Parameters(); //param.PutExtra(EndScreenManager.PLAYERNAME_PARAM, winner.GetDefaultName()); param.PutObjectExtra(EndScreenManager.WINNER, winner); EventBroadcaster.Instance.PostEvent(EventNames.UI.SHOW_END_SCREEN, param); Debug.Log("<color=red> END: EndGame()</color>"); yield return(null); }
IEnumerator SpinWheelPhase() { hasSpun = false; arenaAnimator.OpenRoulette(); yield return(new WaitUntil(() => hasSpun)); Rules rule = RuleInfo.ToRuleEnum(roulette.GetPointedTo()); arenaAnimator.CloseRoulette(); Parameters param = new Parameters(); param.PutObjectExtra(RuleManager.RULE_PARAM, new RuleInfo(rule)); EventBroadcaster.Instance.PostEvent(EventNames.UI.RULE_UPDATE, param); HandleRouletteEvent(rule); yield return(StartCoroutine(EvaluateWheelPhase())); }
IEnumerator SpinWheelPhase() { MainScreenManager_PhaseScreen.Instance.ShowRoulettePhase(); hasSpun = false; arenaAnimator.OpenRoulette(); yield return(new WaitUntil(() => hasSpun)); // Hide roulette phase panel MainScreenManager_PhaseScreen.Instance.Hide(); this.currentRule = RuleInfo.ToRuleEnum(roulette.GetPointedTo()); arenaAnimator.CloseRoulette(); Debug.Log("CURRENT RULE: " + currentRule + "--" + roulette.GetPointedTo()); Parameters param = new Parameters(); param.PutObjectExtra(RuleManager.RULE_PARAM, new RuleInfo(currentRule)); EventBroadcaster.Instance.PostEvent(EventNames.UI.RULE_UPDATE, param); HandleRouletteEvent(currentRule); currentCoroutine = StartCoroutine(EvaluateWheelPhase()); }
// Update is called once per frame void Update() { if (!GameManager.Instance.IsPlaying()) { return; } Direction direction; if (Input.GetKeyDown(KeyCode.W)) { direction = Direction.UP; } else if (Input.GetKeyDown(KeyCode.A)) { direction = Direction.LEFT; } else if (Input.GetKeyDown(KeyCode.D)) { direction = Direction.RIGHT; } else if (Input.GetKeyDown(KeyCode.S)) { direction = Direction.DOWN; } else { return; } // Notify on swipe var parameters = new Parameters(); parameters.PutObjectExtra(EnemyMechanicHandler.PARAM_DIRECTION, direction); EventBroadcaster.Instance.PostEvent(EventNames.ON_SWIPE, parameters); }