// Use this for initialization void Start() { //查找玩家的实例 this.player = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerControl>(); //查找摄像机的实例对象 this.main_camera = GameObject.FindGameObjectWithTag("MainCamera"); this.level_control = new LevelControl(); this.level_control.scene_control = this; this.level_control.player = this.player; this.level_control.OniGroupPrefab = this.OniGroupPrefab; this.level_control.Create(); scoreControl = GetComponent <ScoreControl>(); //清空游戏的结果 this.result.oni_defeat_num = 0; this.result.eval_count = new int[(int)EVALUATION.NUM]; this.result.rank = 0; this.result.score = 0; this.result.score_max = 0; for (int i = 0; i < this.result.eval_count.Length; i++) { this.result.eval_count[i] = 0; } //this.GetComponent //直接游戏 this.step = Step.Game; }
public void _SelectUpgradeUI() { int id = selectedTower.GetTowerID(); UnitTower upgradeTower; upgradeTower = FindUpgrade(id); if (upgradeTower != null) { GameObject obj; PoolManager.Unspawn(selectedTower.transform); GameManager.ClearIndicator(); obj = PoolManager.Spawn(upgradeTower.transform, selectedTower.transform.position, Quaternion.identity); ScoreControl.CoinDecrease(selectedTower.baseTower.upgradeCost); obj.GetComponent <SpriteRenderer>().sortingLayerName = selectedTower.GetComponent <SpriteRenderer>().sortingLayerName; AudioManager.PlayTowerBuilding(); GameManager.ClearUpgradeUI(); GameManager.ClearDismantleUI(); selectedTower = null; } if (upgradeTower == null) { GameManager.ClearUpgradeUI(); GameManager.ClearDismantleUI(); selectedTower = null; } }
public void UpdateBuilState(GameObject[] buildings) { float ratio = 0.8f; foreach (GameObject building in buildings) { TowerPool tower; tower = PoolManager.poolManager.GetTowerParamFromID(ReadFromExcel.ExtractInt(building.name)); int cost = tower.towerAttri.cost; Transform can = building.transform.FindChild("Canvas"); GameObject tex = can.FindChild("Text").gameObject; Text text = tex.transform.GetComponent <Text>(); text.text = "$ " + cost.ToString(); //tex.GetComponent<Text>().text = "$" + cost.ToString(); if (ScoreControl.CheckResourceSuffi(cost) == false) { building.GetComponent <SpriteRenderer>().color = new Color(ratio, ratio, ratio, 1.0f); text.color = new Color(ratio, ratio, ratio, 1.0f); building.GetComponent <BoxCollider2D>().enabled = false; } else { building.GetComponent <BoxCollider2D>().enabled = true; text.color = Color.white; building.GetComponent <SpriteRenderer>().color = Color.white; } } }
// Use this for initialization void Start() { player = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerControl>(); player.gameSceneControl = this; levelControl = new LevelControl(); levelControl.gameSceneControl = this; levelControl.player = player; levelControl.oniGroupPrefab = oniGroupPrefab; levelControl.Create(); resultControl = new ResultControl(); gameUIControl = GameUIControl.Instance; scoreControl = gameUIControl.scoreControl; result.oniDefeatNum = 0; result.evaluationCount = new int[(int)Evaluation.Num]; result.rank = 0; result.score = 0; result.scoreMax = 0; for (int i = 0; i < result.evaluationCount.Length; i++) { result.evaluationCount[i] = 0; } fadeControl = FadeControl.Instance; fadeControl.Fade(3.0f, new Color(0, 0, 0, 1.0f), new Color(0, 0, 0, 0)); nextState = State.Start; }
public GameObject _Select(GameObject icon) { int id = ReadFromExcel.ExtractInt(icon.name); foreach (UnitTower tower in towers) { if (ReadFromExcel.ExtractInt(tower.name) == id) { //Vector3 pos = new Vector3 (0, 0, 0); GameObject obj; obj = PoolManager.Spawn(tower.gameObject, selectedFlag.transform.position, Quaternion.identity); ScoreControl.CoinDecrease(tower.baseTower.cost); obj.GetComponent <SpriteRenderer>().sortingLayerName = selectedFlag.GetComponent <SpriteRenderer>().sortingLayerName; //GameManager.ShowIndicator(obj.GetComponent<UnitTower>()); //GameManager.ClearBaseBuildings(); //buildManager.ClearBuildPoint(); AudioManager.PlayTowerBuilding(); PoolManager.Unspawn(selectedFlag); selectedFlag = null; break; } } //PoolManager.Spawn( selectedIcon = icon; return(selectedIcon); }
// -------------------------------------------------------------------------------- // void Start() { this.scene_control = GetComponent <SceneControl>(); this.score_control = GetComponent <ScoreControl>(); this.score_control.setNumForce(this.scene_control.result.oni_defeat_num); }
public void LightMoveBeginCompleted() { ScoreControl.mThrough++; GamePlay.instance.LabelThrough.text = ScoreControl.mThrough.ToString(); ScoreControl.saveGame(); GameObject.Destroy(this.gameObject); }
public void enigmaUpdate() { print("enigmaUpdate..."); string description = dataGO.GetComponent <Enigme_Data>().enigmaDescription; descriptionGO.GetComponent <UnityEngine.UI.Text>().text = description; print("description " + description); string title = dataGO.GetComponent <Enigme_Data>().enigmaTitle; enigmaTitleGO.GetComponent <UnityEngine.UI.Text>().text = title; print("title " + title); string type = dataGO.GetComponent <Enigme_Data>().enigmaType.ToString(); enigmaTypeGO.GetComponent <UnityEngine.UI.Text>().text = type; string diff = dataGO.GetComponent <Enigme_Data>().enigmaDifficulty.ToString(); enigmaDifficultyGO.GetComponent <UnityEngine.UI.Text>().text = diff; int enigmaId = dataGO.GetComponent <Enigme_Data>().enigmaId; ScoreControl.updateId(enigmaId); int enigmaMaxAttempts = dataGO.GetComponent <Enigme_Data>().enigmaMaxAttempts; ScoreControl.updateMaxAttempts(enigmaMaxAttempts); resetTimer(); }
public static void ConsumeCube(CubeData cube) { Vector2 _pos; if (cube.color == instance.lastCube.color) { instance.multiplier++; _pos = Camera.main.WorldToScreenPoint(cube.objTrans.position); MultiplierControl.ShowMultiplier(cube.color, instance.multiplier, _pos); AudioControl.PlayFX("multiplier"); } else { instance.multiplier = 1; } instance.lastCube = cube; instance.points += cube.points * instance.multiplier; instance.StartCoroutine(instance.destroyCube(cube)); ScoreControl.Set(instance.points); if ((state == PLAYING) && (SpawnManager.RemainCubes() == 0)) { state = SUCCESS; TitleControl.Animate("GOOD JOB!", TitleControl.SUCCESS_ANIM); instance.nextUpdate = Time.time + 2; } }
public void DiamondMoveBeginCompleted() { SoundEngine.getInstance().PlayOneShot(SoundEngine.getInstance()._soundDiamond); ScoreControl.Coin += 50; GameObject.Destroy(this.gameObject); ScoreControl.saveCoin(); GamePlay.instance.LabelCoin.text = ScoreControl.Coin.ToString(); }
//public HUDScript hudCanvas; // Start is called before the first frame update void Start() { hs = GameObject.Find("obvious").GetComponent <HUDScript>(); rigidBody = this.GetComponent <Rigidbody2D>(); rigidBody.gravityScale = 1.0f; GetComponent <AudioSource>().playOnAwake = false; sc = score.GetComponent <ScoreControl>(); }
void Awake() { controller = GetComponent <PlayerController>(); score = GetComponent <ScoreControl>(); platform = Resources.Load("Platform") as GameObject; platformContainer = Resources.Load("PlatformArea") as GameObject; gameController = GameObject.FindGameObjectWithTag("Game"); }
public void WithScoreOf(int score, Vector3 positionOfItem) { theScore = FindObjectOfType <ScoreControl>(); theScore.AddScore(score); MyScore = score; tester = true; Score.transform.position = positionOfItem; }
public override void enter() { gameOverImg.gameObject.SetActive(true); gameObject.GetComponent <AudioSource> ().clip = over; gameObject.GetComponent <AudioSource> ().Play(); scoreControl = ScoreControl.Instance; Invoke("destroyGamePanel", 4.0f); }
// ================================================================ // // MonoBehaviour에서 상속. void Start() { this.player = GameObject.FindGameObjectWithTag("Player").GetComponent<PlayerControl>(); this.score_control = this.gameObject.GetComponent<ScoreControl>(); this.sound_control = GameObject.Find("SoundRoot").GetComponent<SoundControl>(); this.next_step = STEP.PLAY; }
private void Awake() { obstacleQueueControl = GetComponent<ObstacleQueueControl>(); scoreControl = GetComponent<ScoreControl>(); timeControl = GetComponent<TimeControl>(); treeTapControl = GetComponent<TreeTapControl>(); loseText = GameObject.Find ("LoseText").GetComponent<GUIText>(); highScore = GameObject.Find ("HighScoreText").GetComponent<GUIText>(); }
// ================================================================ // // MonoBehaviour에서 상속. void Start() { this.player = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerControl>(); this.score_control = this.gameObject.GetComponent <ScoreControl>(); this.sound_control = GameObject.Find("SoundRoot").GetComponent <SoundControl>(); this.next_step = STEP.PLAY; }
private void Awake() { obstacleControl = GetComponent<ObstacleQueueControl>(); scoreControl = GetComponent<ScoreControl>(); timeControl = GetComponent<TimeControl>(); flowControl = GetComponent<FlowControl>(); deerLeft = GameObject.Find("DeerLeft"); deerRight = GameObject.Find("DeerRight"); }
void Start() { health = size == 1 ? settings.asteroidSmallHealth : size == 2 ? settings.asteroidMediumHealth : settings.asteroidLargeHealth; damagePerHit = settings.damagerPerHit; GameObject gameController = GameObject.FindGameObjectWithTag("GameController"); tilingCtrl = gameController.GetComponent <ScreenTilingCtrl> (); scoreCtrl = gameController.GetComponent <ScoreControl> (); rb = GetComponent <Rigidbody2D> (); }
void Start() { distanceToTravel = -40f; targetPosition = new Vector3(transform.position.x, 0, transform.position.z + distanceToTravel); explosion = GetComponent <ParticleSystem>(); //Locating the gameObject holding the ScoreManager script in the scene scoreScript = GameObject.Find("GameManager").GetComponent <ScoreControl>(); }
void OnMouseOver() { if (bonusType == BonusType.em_Essence) { ScoreControl.EssenceIncrease(increaseAmount); } //this.transform.parent.gameObject.SetActive (false); Destroy(this.transform.parent.gameObject); //Destroy(this.gameObject); PoolManager.Unspawn(this.transform.parent.gameObject); }
public UnityEngine.Sprite[] uiSprite_Grade; // 用于显示总体评价的文字(优/良/可/不可) // ================================================================ // void Awake() { this.scene_control = SceneControl.get(); this.score_control = GetComponent <ScoreControl>(); this.score_control.setNumForce(this.scene_control.result.oni_defeat_num); this.rankSmallDefeat.uiSpriteRank = this.uiSprite_GradeSmall; this.rankSmallEval.uiSpriteRank = this.uiSprite_GradeSmall; this.rankTotal.uiSpriteRank = this.uiSprite_Grade; }
void Awake() { gameSceneControl = GameSceneControl.Instance; scoreControl = GetComponent <ScoreControl>(); scoreControl.SetScoreForce(gameSceneControl.result.oniDefeatNum); defeatRank.rankSprites = gradeSmallSprites; evaluationRank.rankSprites = gradeSmallSprites; totalRank.rankSprites = gradeSprites; }
void Start() { instance = this; time = 60; points = 0; TimerControl.Set((int)time); ScoreControl.Set(points); state = STANDBY; nextUpdate = Time.time + 3; FaderControl.FadeOut(2); }
// Use this for initialization void Start() { //GameObject canvasObj = GameObject.FindWithTag("Canvas"); GameObject gamePanelObj = GameObject.FindWithTag("Game"); GameObject lifeControlObj = GameObject.FindWithTag("LifeControl"); lifeNumControl = lifeControlObj.GetComponent <LifeNumControl> (); scoreControl = lifeControlObj.GetComponent <ScoreControl> (); //canvas = canvasObj.GetComponent<Canvas> (); gameRule = gamePanelObj.GetComponent <GameRule> (); sound = gamePanelObj.GetComponent <AudioSource> (); }
void OnBecameInvisible() { //have some problems if (this != null) { if (this.HpAttribute.m_curHp < this.visitorAttri.angryLimit && targetPoint == null) { ScoreControl.AngryIncrease(1); } thisObj.SetActive(false); } }
// ================================================================ // // MonoBehaviour에서 상속. void Start() { this.next_step = STEP.RUN; this.current_speed = SPEED_MIN; this.score_control = ScoreControl.getInstance(); this.coin_creator = CoinCreator.getInstance(); this.anim_player = this.transform.GetComponentInChildren <Animation>(); //motion. this.sound_control = GameObject.Find("SoundRoot").GetComponent <SoundControl>(); }
public float distanceBetweenAnts = 1.5f; // defined distance between each ant in the party /* Purpose: called once at object instantiation, for initializing fields * NOTE: any public values that are modified in the Unity editor will get that value overwritten * if reassigned with this method * * Last Date Modified: February 11, 2017 by NP */ void Start() { scoreKeeper = GameObject.Find("Level Manager").GetComponent <ScoreControl> (); ground = GameObject.Find("Ground").GetComponent <Transform>().gameObject; for (int i = 0; i < transform.childCount; i++) { ant.Add(transform.GetChild(i).gameObject); // populate ant List with all children objects within Player GameObject } initializeIgnoreColliders(); initializeAnts(); positionAnts(); // position each ant in straight line with appropriate margins, according to their ordering and position from point }
public void BoomButtonPress() { //here if (ScoreControl.mBoom > 0 && GamePlay.currentState == GamePlay.STATE_PLAY && LevelManager.currentBubbleWaiting != null) { SoundEngine.getInstance().PlayOneShot(SoundEngine.getInstance()._soundBone); //LevelManager.currentBubble.collider2D.isTrigger = true; LevelManager.currentBubbleWaiting.GetComponent <Bubble>().setValue(BubbleType.BUBBLE_TYPE_SHOOT_BOOM_CICLE); ScoreControl.mBoom--; ScoreControl.saveGame(); GamePlay.instance.setCountTextEffect(); } }
void Start() { GameObject scoreControlObject = GameObject.FindWithTag("Score"); if (scoreControlObject != null) { scoreControl = scoreControlObject.GetComponent <ScoreControl>(); } if (scoreControl == null) { Debug.Log("Cannot find 'GameController' script"); } }
/// <summary> /// Instancira se prazan Player objekat i dodeljuju reference za sve komponente /// </summary> void Awake() { player = new Player(); localDB = GameObject.Find("LocalDBControler").GetComponent <LocalDBControler>(); firebase = GameObject.Find("FirebaseControler").GetComponent <FirebaseControler>(); ui = GameObject.Find("UIControler").GetComponent <UIControler>(); fb = GameObject.Find("FacebookControler").GetComponent <FacebookControler>(); ads = GameObject.Find("AdsControler").GetComponent <AdsControler>(); purchaser = GameObject.Find("Purchaser").GetComponent <Purchaser>(); social = GameObject.Find("SocialControler").GetComponent <SocialControl>(); score = GameObject.Find("ScoreControler").GetComponent <ScoreControl>(); gift = GameObject.Find("RewardControler").GetComponent <RewardControl>(); }
public void _ShowUpgrade(UnitTower tower) { Vector3 pos; if (upgradeUI != null) { int upprice = tower.baseTower.upgradeCost; Transform can = upgradeUI.gameObject.transform.FindChild("Canvas"); GameObject tex = can.FindChild("Text").gameObject; Text text = tex.transform.GetComponent <Text>(); text.text = "$" + upprice.ToString(); pos = tower.thisT.position; float height = upgradeUI.GetComponent <BoxCollider2D>().size.y *upgradeUI.transform.localScale.y; if (pos.y + tower.GetComponent <BoxCollider2D>().size.y + height / 2 + 0.05f < maxY) { upgradeUI.transform.position = new Vector3(pos.x, pos.y + tower.GetComponent <BoxCollider2D>().size.y + height / 2 + 0.05f, pos.z); } else { float width = upgradeUI.GetComponent <BoxCollider2D>().size.x *upgradeUI.transform.localScale.x; float width2 = tower.GetComponent <BoxCollider2D>().size.x; upgradeUI.transform.position = new Vector3(pos.x - width2 / 2 - width / 2 - 0.05f, pos.y, pos.z); } upgradeUI.GetComponent <Renderer>().enabled = true; if (ScoreControl.CheckResourceSuffi(upprice) == true && BuildManager.FindUpgrade(ReadFromExcel.ExtractInt(tower.name))) { upgradeUI.GetComponent <SpriteRenderer>().color = Color.white; text.color = Color.white; upgradeUI.GetComponent <BoxCollider2D>().enabled = true; Transform child; if ((child = upgradeUI.transform.FindChild("mouseOver")) != null) { child.GetComponent <Renderer>().enabled = true; } } else { upgradeUI.GetComponent <SpriteRenderer>().color = new Color(0.8f, 0.8f, 0.8f, 1.0f); text.color = new Color(0.8f, 0.8f, 0.8f, 1.0f); upgradeUI.GetComponent <BoxCollider2D>().enabled = false; Transform child; if ((child = upgradeUI.transform.FindChild("mouseOver")) != null) { child.GetComponent <Renderer>().enabled = false; } } } }
/*------------------------------------ * GetScore(private版) * * summary:各スコアを取得 * param :なし(void) * return :なし(void) * ------------------------------------*/ void GetScore() { /* 赤スコア */ ScoreControl sc = GameObject.FindGameObjectWithTag("RedScore").GetComponent <ScoreControl>(); m_score[(int)COLOR.RED] = sc.GetScore(); /* 緑スコア */ sc = GameObject.FindGameObjectWithTag("GreenScore").GetComponent <ScoreControl>(); m_score[(int)COLOR.GREEN] = sc.GetScore(); /* 青スコア */ sc = GameObject.FindGameObjectWithTag("BlueScore").GetComponent <ScoreControl>(); m_score[(int)COLOR.BLUE] = sc.GetScore(); }
void Awake() { if ( control == null ) { DontDestroyOnLoad(gameObject); control = this; // this is due to JIT compilation required for the binary formatter, which // is NOT allowed on iOS. Environment.SetEnvironmentVariable("MONO_REFLECTION_SERIALIZER", "yes"); // slurp control.Load(); } else if ( control == this ) { Destroy(gameObject); } }
public void InitEvents () { fc = FlowControl.Instance; lc = LevelControl.Instance; sc = ScoreControl.Instance; uic = UIControl.Instance; dc = DataControl.Instance; shootC = GameObject.Find ("Player").GetComponent<ShootingController> (); lc.BallsChanged += OnBallsChanged; lc.LevelChanged += OnLevelChanged; lc.TargetsChanged += OnTargetsChanged; sc.ScoreChanged += OnScoreChanged; shootC.InitPowerSlider += OnInitPowerSlider; shootC.UpdatePowerSlider += OnUpdatePowerSlider; string levelKind = dc.GetLevel (fc.Level).Kind; if (levelKind.Equals ("T")) GameObject.Find ("Player").GetComponent<MoveOnTrails> ().TrailsEndReached += OnTrailsEndReached; }
// Use this for initialization void Start() { renderers = GetComponentsInChildren<Renderer>(); audioMngr = GameObject.FindObjectOfType<AudioManager> (); scoreControl = GameObject.FindGameObjectWithTag("UI").GetComponent<ScoreControl>(); if (type == Type.Coin) { renderers[1].material.SetColor("_Color", Color.yellow); } else if (type == Type.PickUp) { renderers[1].material.SetColor("_Color", Color.blue); } }
public void Proceed () { if (Status == STATUS.PLAYING) { EventControl.Instance.InitEvents (); lc = LevelControl.Instance; lc.Level = level; Level lev = DataControl.Instance.GetLevel (level); lc.BallsInitial = lev.Balls; lc.Targets = lev.Targets; sc = ScoreControl.Instance; sc.Score = 0; Cursor.visible = false; } else { Cursor.visible = true; } }
// ================================================================ // // MonoBehaviour からの継承. void Start() { this.score_control = this.gameObject.GetComponent<ScoreControl>(); }
void Awake() { playerRigidbody = GetComponent<Rigidbody2D>(); scoreControl = GameObject.Find("ScoreControl").GetComponent<ScoreControl>(); }
private void Awake() { Instance = this; }
// ゲームオーバー時に、今回のスコアーをセットする. public void setLastScore(ScoreControl.Score last_score) { this.last_socre = last_score; // ハイスコア―更新チェック. this.high_score.score = Mathf.Max(this.high_score.score, this.last_socre.score); this.high_score.coins = Mathf.Max(this.high_score.coins, this.last_socre.coins); }
// -------------------------------------------------------------------------------- // void Start() { // プレイヤーのインスタンスを探しておく. this.player = GameObject.FindGameObjectWithTag("Player").GetComponent<PlayerControl>(); this.player.scene_control = this; // スコアのインスタンスを探しておく. this.score_control = GetComponent<ScoreControl>(); // カメラのインスタンスを探しておく. this.main_camera = GameObject.FindGameObjectWithTag("MainCamera"); this.level_control = new LevelControl(); this.level_control.scene_control = this; this.level_control.player = this.player; this.level_control.OniGroupPrefab = this.OniGroupPrefab; this.level_control.create(); this.result_control = new ResultControl(); // GUI 制御のスクリプト(コンポーネント). this.gui_control = this.GetComponent<GUIControl>(); // フェードコントロールの追加 fader = gameObject.AddComponent<FadeControl>(); // ゲームの結果をクリアーしておく. this.result.oni_defeat_num = 0; this.result.eval_count = new int[(int)EVALUATION.NUM]; this.result.rank = 0; this.result.score = 0; this.result.score_max = 0; for(int i = 0;i < this.result.eval_count.Length;i++) { this.result.eval_count[i] = 0; } // フェードインで開始 this.fader.fade( 3.0f, new Color( 0.0f, 0.0f, 0.0f, 1.0f ), new Color( 0.0f, 0.0f, 0.0f, 0.0f ) ); this.step = STEP.START; }
// ================================================================ // // MonoBehaviour에서 상속. void Start() { this.next_step = STEP.RUN; this.current_speed = SPEED_MIN; this.score_control = ScoreControl.getInstance(); this.coin_creator = CoinCreator.getInstance(); this.anim_player = this.transform.GetComponentInChildren<Animation>(); //motion. this.sound_control = GameObject.Find("SoundRoot").GetComponent<SoundControl>(); }
// -------------------------------------------------------------------------------- // void Start() { this.scene_control = GetComponent<SceneControl>(); this.score_control = GetComponent<ScoreControl>(); this.score_control.setNumForce( this.scene_control.result.oni_defeat_num ); }
// 게임 오버 시에 이번 점수를 설정한다. public void setLastScore(ScoreControl.Score last_score) { this.last_socre = last_score; // 최고 점수 - 갱신 체크. this.high_score.score = Mathf.Max(this.high_score.score, this.last_socre.score); this.high_score.coins = Mathf.Max(this.high_score.coins, this.last_socre.coins); }
void Awake () { //Make this active and only instance instance = this; score = 0; }