// handles attacking phase public void Attacking(int extraDamage) { int hitting = Random.Range(1, 7) + attack; Debug.Log("TO HIT: " + hitting); if (hitting > currentEnemy.GetComponent <CharacterBase>().defense) { currentEnemy.GetComponent <CharacterBase>().health -= attack + extraDamage; Debug.Log("HIT! - " + currentEnemy.GetComponent <CharacterBase>().charName + ": " + currentEnemy.GetComponent <CharacterBase>().health); FloatText.CreateFloatText("−" + (attack + extraDamage), new Color(100, 0, 0.1f), currentEnemy.transform.position + 2 * Vector3.up); } else { Debug.Log( "MISS! - " + currentEnemy.GetComponent <CharacterBase>().charName + ": " + currentEnemy.GetComponent <CharacterBase>().health); FloatText.CreateFloatText("Miss", new Color(0, 0.2f, 1), currentEnemy.transform.position + 2 * Vector3.up); } if (currentEnemy.GetComponent <CharacterBase>().health <= 0) { currentEnemy.GetComponent <CharacterBase>().GetDown(); } }
void Update() { if (Swtich == true) { Timer -= Time.deltaTime; if (Timer < 0.6f) { GameObject.Find(Manager._selectedName[Control.now_Player] + "Arrow").GetComponent <MeshRenderer>().enabled = false; } if (Timer < 0) { Control._playerHp[now] -= 100; GameObject.Find("Canvas").GetComponent <Control>().GetTargetCamera(GameObject.Find(Manager._selectedName[now])); FloatText.Click(GameObject.Find(Manager._selectedName[now]), 100, "-"); FloatText.story_text(Manager._selectedName[now] + "寫著:" + Manager._selectedName[Control.now_Player] + "好像被鬼火獸的毒所侵害了,竟然在晚上的時候爬起來攻擊我。" , Manager._selectedName[now] + "被" + Manager._selectedName[Control.now_Player] + "襲擊損傷了 100點生命"); Time.timeScale = 0; GameObject.Find("Canvas").GetComponent <Control>().dice.enabled = true; GameObject.Find("Canvas").GetComponent <Control>().next.enabled = false; Swtich = false; } } if (GridContent.attack == true) { if (Manager2._selectedName.Count == Manager2._countLimit) { attack.enabled = true; } else { attack.enabled = false; } } }
public void AIDecision(int decision) { if (isDowned == true) { return; } switch (decision) { case 1: // nothing Debug.Log("AI - Nothing"); FloatText.CreateFloatText("Loafing...", Color.blue, transform.position + 2 * Vector3.up); currentEnemy = null; break; case 2: case 3: case 4: // Have player selected in the game loop through local player list Attacking(-3); Debug.Log("AI - Attacking"); currentEnemy = null; break; case 5: health += 1; Debug.Log("AI - Healing - " + health); currentEnemy = null; FloatText.CreateFloatText("+1", Color.green, transform.position + 2 * Vector3.up); break; } }
/// <summary> /// 動作完了判定閾値 設定変更後イベント /// </summary> /// <param name="sender">sender</param> /// <param name="e">e</param> private void evMoveEndRateSettingChanged(object sender, EventArgs e) { SettingData setting = SettingData.GetInstance(); FloatText moveEndRateText = (FloatText)pnlSetting.Controls[4]; setting.MoveEndRate = moveEndRateText.Value; }
public static void CreateFloatingText(string text, Transform location) { FloatText instance = Instantiate(popupTextPrefab); instance.transform.SetParent(canvas.transform, false); instance.SetText(text); }
public void Next_Click() //下一個人 { if (now_Player == Manager._countLimit - 1) { now_Player = 0; } else { now_Player++; } if (_state[now_Player] == PlayerState.Death) { GetCamera(); DiceImage.sprite = Resources.Load <Sprite>("Dice/Death") as Sprite; } else if (_state[now_Player] == PlayerState.Sleep) { _state[now_Player] = PlayerState.Stop; DiceImage.sprite = Resources.Load <Sprite>("Dice/Sleep") as Sprite; } else { GetProps(); GetCamera(); DiceImage.sprite = Resources.Load <Sprite>("Dice/DiceQ") as Sprite; } next.enabled = false; GameObject.Find("GameOver").GetComponent <Image>().enabled = false; FloatText.Prompt_text(Manager._selectedName[Control.now_Player] + " Round"); }
// 创建生命条 FloatText createFloatText(Transform trans, int val) { GameObject gameObject = Instantiate(prefab, Root, false); FloatText floatText = gameObject.GetComponent <FloatText>(); floatText.OnUse(trans, val.ToString()); return(floatText); }
// Token: 0x06000033 RID: 51 RVA: 0x00002FBC File Offset: 0x000011BC private void _CreateFloatText(Vector3 pos, string text, Color color) { FloatText orCreateText = this.GetOrCreateText(); orCreateText.mgr = this; orCreateText.color = color; this.runingTexts.Add(orCreateText); orCreateText.OnUse(pos, text); }
private FloatText createText() { GameObject floatingText = Instantiate(FloatingTextPrefab) as GameObject; FloatText FloatTextObject = floatingText.GetComponent <FloatText>(); FloatTextObject.score = ranScore; FloatTextObject.transform.SetParent(canvas.transform, false); return(FloatTextObject); }
void Update() //產生時間 { time -= Time.deltaTime; if (time < 0) { Destroy(Spikes); FloatText.story_text(story, nameText); } }
private void DestroyText(FloatText text) { if (pools.Count > _Instance.maxPoolCount) { GameObject.Destroy(text); return; } text.OnRecycle(); pools.Enqueue(text); }
void Awake() { duel = Duel.GetInstance(); mDeckUI = transform.FindChild("MDeckUI").GetComponent <GameFieldUI>(); oDeckUI = transform.FindChild("ODeckUI").GetComponent <GameFieldUI>(); mHandCardUI = transform.FindChild("MHandCard").GetComponent <HandCardUI>(); oHandCardUI = transform.FindChild("OHandCard").GetComponent <HandCardUI>(); mHandCardUI.Init(); oHandCardUI.Init(); mFieldMgr = transform.FindChild("MField").GetComponent <FieldMgr>(); oFieldMgr = transform.FindChild("OField").GetComponent <FieldMgr>(); mFieldMgr.Init(true); oFieldMgr.Init(false); mLpSliderUI = transform.FindChild("LPSlider_player1").GetComponent <LPSliderUI>(); oLpSliderUI = transform.FindChild("LPSlider_player2").GetComponent <LPSliderUI>(); lpChangeUI = transform.FindChild("lpChangeUI").GetComponent <LPChangeUI>(); cardEffectAnim = transform.FindChild("CardEffectAnim").GetComponent <CardEffectAnim>(); selectEffectUI = transform.FindChild("SelectEffectUI").GetComponent <SelectEffectUI>(); phaseButtonMgr = transform.FindChild("PhaseButton").GetComponent <PhaseButtonMgr>(); guessFirst = transform.FindChild("GuessFirst").GetComponent <GuessFirst>(); floatText = transform.FindChild("FloatText").GetComponent <FloatText>(); selectCardShowUI = transform.FindChild("SelectCardShow").GetComponent <SelectCardShowUI>(); selectPutType = transform.FindChild("SelectPutType").GetComponent <SelectPutType>(); mDrawCardAnim = transform.FindChild("MDrawCardAnim").GetComponent <DrawCardAnim>(); oDrawCardAnim = transform.FindChild("ODrawCardAnim").GetComponent <DrawCardAnim>(); attackAnim = transform.FindChild("AttackAnim").GetComponent <AttactAnim>(); roundCounterUI = GetChild <RoundCountUI>("RoundNumText"); mChangeAreaAnim = GetChild <ChangeAreaAnim>("MAnim"); oChangeAreaAnim = GetChild <ChangeAreaAnim>("OAnim"); chainUICtr = GetChild <ChainUICtr>("ChainUIMgr"); selectCardMgr = SelectCardMgr.GetInstance(); optionListUI = OptionListUI.GetInstance(); dialogBoxUI = DialogBoxUI.GetInstance(); selectCardUI = SelectCardUI.GetInstance(); tipPlane = ErrorPlane.GetInstance(); selectCardMgr.Init(); phaseButtonMgr.Init(); selectEffectUI.Init(); cardEffectAnim.Init(); lpChangeUI.Init(); optionListUI.Init(); dialogBoxUI.Init(); selectCardUI.Init(); selectPutType.Init(); attackAnim.Init(); }
// Token: 0x0600002F RID: 47 RVA: 0x00002EB0 File Offset: 0x000010B0 private void DestroyText(FloatText text) { bool flag = this.pools.Count > FloatTextManager._Instance.maxPoolCount; if (flag) { Object.Destroy(text); } else { text.OnRecycle(); this.pools.Enqueue(text); } }
// Update is called once per frame void Update() { if (Input.GetKey(KeyCode.Space)) { float x = Random.Range(-5f, 5f); float y = Random.Range(1f, 5f); float z = Random.Range(-5f, 5f); spawned = Instantiate(floatTextPrefab, new Vector3(x, y, z), Quaternion.identity); spawnedScript = spawned.GetComponent <FloatText>(); spawnedScript.fontSize = Random.Range(8f, 24f); spawnedScript.displayText = "Instance #" + Random.Range(1, 1000); spawnedScript.displayColor = new Color(Random.Range(0.2f, 0.8f), Random.Range(0.2f, 0.8f), Random.Range(0.2f, 0.8f)); } }
/// <summary> /// 設定更新 /// </summary> private void updateSettings() { SettingData setting = SettingData.GetInstance(); DoubleText doubleText = null; // ロボットの縦 doubleText = (DoubleText)pnlSetting.Controls[0]; doubleText.Value = setting.RobotSize.Vertical; // ロボットの横 doubleText = (DoubleText)pnlSetting.Controls[1]; doubleText.Value = setting.RobotSize.Horizontal; // 畑の縦 doubleText = (DoubleText)pnlSetting.Controls[2]; doubleText.Value = setting.FarmSize.Vertical; // 畑の横 doubleText = (DoubleText)pnlSetting.Controls[3]; doubleText.Value = setting.FarmSize.Horizontal; // 草刈り開始時刻 usrKusakariStart.DayOfWeek = (int)setting.KusakariStart.DayOfWeek; usrKusakariStart.Hour = setting.KusakariStart.Hour; usrKusakariStart.Minute = setting.KusakariStart.Minulte; // 夜警開始時刻 usrYakeiStart.DayOfWeek = (int)setting.YakeiStart.DayOfWeek; usrYakeiStart.Hour = setting.YakeiStart.Hour; usrYakeiStart.Minute = setting.YakeiStart.Minulte; // 動作完了判定閾値 FloatText floatText = (FloatText)pnlSetting.Controls[4]; floatText.Value = setting.MoveEndRate * 100; // エリアマップ生成 AreaMap areaMap = AreaMap.GetInstance(); areaMap.Allocate(setting.MapLength, setting.MapWidth); // 動作マップ生成 MoveMap moveMap = MoveMap.GetInstance(); moveMap.Allocate(setting.MapLength, setting.MapWidth); }
//void FixedUpdate() //{ // // Get direction from this enemy to the player // Vector3 direction = (playerTransform.position - transform.position).normalized; // // Apply a force in the given direction // rb.AddForce(direction * movementSpeed); //} public void loseHealth(int amount) { // Display amount of damage taken, as floating text FloatText floatText = ObjectPooler.Instance.SpawnObject("FloatText", transform.position, Camera.main.transform.rotation).GetComponent <FloatText>(); floatText.Message = amount.ToString(); // Lose health health -= amount; // Destroy this enemy after health has reached zero if (health <= 0) { //Destroy(gameObject); gameObject.SetActive(false); } }
// Token: 0x06000030 RID: 48 RVA: 0x00002EF8 File Offset: 0x000010F8 private FloatText GetOrCreateText() { bool flag = this.pools.Count > 0; FloatText result; if (flag) { result = this.pools.Dequeue(); } else { GameObject gameObject = Object.Instantiate <GameObject>(this.prefab, this.canvas.transform, false); FloatText component = gameObject.GetComponent <FloatText>(); result = component; } return(result); }
public static void CreateFloatText(string text, Color colour, Vector3 position, Vector3 floatDirection, float fontSize = 8, float floatTime = 1, float floatSpeed = 1, float disappearPercentage = 0.5f) { if (!prefab) { prefab = Resources.Load <GameObject>("Float text"); FloatText inst = Instantiate(prefab, position, Quaternion.identity).GetComponent <FloatText>(); inst.displayColor = colour; inst.displayText = text; inst.floatDirection = floatDirection; inst.fontSize = fontSize; inst.floatTime = floatTime; inst.floatSpeed = floatSpeed; inst.disappearPercentage = disappearPercentage; } }
public static void _Attack(GameObject Charactor) // 動態產生陷阱包含動作 { Spikes = Instantiate(Resources.Load("Needle")) as GameObject; Spikes.transform.position = Charactor.transform.position; Spikes.transform.position -= new Vector3(0, 0.5f, 0); if (Control._held[Control.now_Player] == Control.Shield.NotHeld) { Control._playerHp[Control.now_Player] -= 50; FloatText.Click(Charactor, 50, "-"); story = "這迷宮不知道是什麼,走著走著竟然還踩到陷阱 !"; nameText = Manager._selectedName[Control.now_Player] + " 踩到陷阱,減少了50點生命"; } else { story = "還好身上還放著保護的裝置,不過受到攻擊後好像被破壞掉了..."; nameText = Manager._selectedName[Control.now_Player] + " 抵擋住攻擊 ,沒有受到任何攻擊"; Control._held[Control.now_Player] = Control.Shield.NotHeld; } }
/// <summary> /// 設定タブ初期化 /// </summary> private void initSettingTab() { DoubleText doubleText = null; usrCommControl.OnConnected += onConnected; usrCommControl.OnDisconnection += onDisconnection; // ロボットの長さ doubleText = new DoubleText(0.1, 10000); doubleText.Title = "ロボットサイズ(縦)"; doubleText.Unit = "mm"; pnlSetting.Controls.Add(doubleText); pnlSetting.Controls.SetChildIndex(doubleText, 0); // ロボットの幅 doubleText = new DoubleText(0.1, 10000); doubleText.Title = "ロボットサイズ(横)"; doubleText.Unit = "mm"; pnlSetting.Controls.Add(doubleText); pnlSetting.Controls.SetChildIndex(doubleText, 1); // 畑の長さ doubleText = new DoubleText(0.1, 10000); doubleText.Title = "畑サイズ(縦)"; doubleText.Unit = "mm"; pnlSetting.Controls.Add(doubleText); pnlSetting.Controls.SetChildIndex(doubleText, 2); // 畑の幅 doubleText = new DoubleText(0.1, 10000); doubleText.Title = "畑サイズ(横)"; doubleText.Unit = "mm"; pnlSetting.Controls.Add(doubleText); pnlSetting.Controls.SetChildIndex(doubleText, 3); // 動作完了判定閾値 FloatText floatText = new FloatText(0.0F, 100.0F); floatText.Title = "動作完了判定割合"; floatText.Unit = "%"; pnlSetting.Controls.Add(floatText); pnlSetting.Controls.SetChildIndex(floatText, 4); }
// Token: 0x0600002D RID: 45 RVA: 0x00002D10 File Offset: 0x00000F10 private void Update() { float deltaTime = Time.deltaTime; foreach (FloatText floatText in this.runingTexts) { floatText.DoUpdate(deltaTime); } for (int i = this.runingTexts.Count - 1; i >= 0; i--) { FloatText floatText2 = this.runingTexts[i]; bool isFinished = floatText2.IsFinished; if (isFinished) { this.runingTexts.RemoveAt(i); this.DestroyText(floatText2); } } }
protected override void FormatAll() { var formatter = ZNumberFormatter.Instance; // Custom: formatter.NumberToChars("(###) ###-####", Time.frameCount * 100 + 5555551234); _custom.Reset("Custom: ").Append(formatter); CustomFormatText.SetZString(_custom); // Currency: var amount = Time.realtimeSinceStartup; for (var i = 0; i < Prices.Length; i++) { formatter.NumberToChars("C", amount, _formats[i]); _prices[i].Reset("Currency: ").Append(formatter); Prices[i].SetZString(_prices[i]); } // Integer: formatter.NumberToChars("D6", Time.frameCount); _integer.Reset("Integer:").Append(formatter); IntegerText.SetZString(_integer); // Float: formatter.NumberToChars("F4", Mathf.Sin(Time.frameCount / 1000f)); _float.Reset("Float: ").Append(formatter); FloatText.SetZString(_float); // Scientific: formatter.NumberToChars("E4", Mathf.Cos(Time.frameCount / 1000f)); _science.Reset("Scientific: ").Append(formatter); ScientificText.SetZString(_science); // Time to Format: if (_count > 0) { formatter.NumberToChars("d3", _ticks / (_count * TimeSpan.TicksPerMillisecond / 1000)); _timeToFormat.Reset("Time to Format: ").Append(formatter).Append(" μs"); TimeToFormat.SetZString(_timeToFormat); } }
public static void MonsterAttack(GameObject Charactor) // 動態產生怪物包含動作 { Control._playerHp[Control.now_Player] -= 200; Spikes = Instantiate(Resources.Load("Monster/Monster")) as GameObject; Spikes.transform.position = Charactor.transform.position; Spikes.transform.position += new Vector3(0, 0, 3f); if (Control._held[Control.now_Player] == Control.Shield.NotHeld) { story = "看到了鬼火獸,沒辦法躲避他的攻擊,受到了一點損傷"; nameText = Manager._selectedName[Control.now_Player] + " 遭受怪物襲擊,減少了200點生命"; FloatText.Click(Charactor, 200, "-"); Time.timeScale = 0; } else { story = "還好身上還放著保護的裝置,不過受到攻擊後好像被破壞掉了..."; nameText = Manager._selectedName[Control.now_Player] + " 抵擋住攻擊 ,沒有受到任何攻擊"; Control._held[Control.now_Player] = Control.Shield.NotHeld; } }
public void AttackGO() //攻擊 { charactorAnim = GameObject.Find(Manager._selectedName[Control.now_Player]).GetComponent <Animator>(); charactorAnim.SetBool("isBow", true); charactorAnim.SetBool("isIdle", false); charactorAnim.SetBool("isRunning", false); charactorAnim.SetBool("isSit", false); GameObject.Find(Manager._selectedName[Control.now_Player] + "Arrow").GetComponent <MeshRenderer>().enabled = true; for (int i = 0; i < Manager._countLimit; i++) { if (Manager._selectedName[i] == Manager2._selectedName[0]) { now = i; FloatText.story_text("剛才鬼火獸劃傷了。有時候都會失去意識。在夜晚好像還會攻擊自己的同伴...", Manager._selectedName[Control.now_Player] + " 攻擊了 " + Manager._selectedName[now]); Time.timeScale = 0; break; } } if (Control._held[now] == Control.Shield.Withstand) { Swtich = false; Control._held[now] = Control.Shield.NotHeld; FloatText.story_text("還好身上還放著保護的裝置,不過受到攻擊後好像被破壞掉了...", Manager._selectedName[now] + "使用了道具抵擋住攻擊"); Time.timeScale = 0; } else { Swtich = true; } MainCanvas.enabled = true; AttackCanvas.enabled = false; for (int i = 1; i <= Manager._countLimit - 1; i++) { GameObject.Find("Player" + i).GetComponent <Toggle>().isOn = false; } Manager2._selectedName = new List <string>(); Swtich = true; Timer = 3; }
public void Damage(float damage, Color color) { enemy.hp -= (int)damage; text.text = enemy.hp.ToString(); if (damageIndecator != null) { FloatText floatText = damageIndecator.GetChild().GetComponent <FloatText>(); // Debug.Log(floatText.name+" " + floatText.isActiveAndEnabled); floatText.transform.position = transform.position; floatText.GetDamage((int)damage, color); } if (enemy.hp <= 0) { master.AddMoeny(100); Turn(); if (enemy.isBoss) { StageManager.GetInstance().Vitory(); } } }
public void UseSpecial() { // sets specials and determines which one is used if (special > 0) { switch (charName) { case "Mando": FloatText.CreateFloatText("Empowered hit", Color.black, transform.position + 2 * Vector3.up); Attacking(3); special--; break; case "Wook": FloatText.CreateFloatText("Triple shot", Color.black, transform.position + 2 * Vector3.up); for (int x = 0; x < 3; x++) { Attacking(0, Vector3.left * (x - 1)); } special--; break; case "Jed": if (!currentTarget) { SelectTarget(); } else { if (currentTarget.health <= 0) { currentTarget.GetComponent <CharacterBase>().Revive(); currentTarget.GetComponent <CharacterBase>().health = 2; currentTarget = null; special--; CompleteTurn(); } else { FloatText.CreateFloatText("He stilll live", new Color(1, 0, 0.8f), currentTarget.transform.position + 2 * Vector3.up); CompleteTurn(); } currentTarget = null; } break; case "Bo": if (!currentTarget) { SelectTarget(); } else { if (currentTarget.health > 0) { FloatText.CreateFloatText("Heal!", Color.black, transform.position + 2 * Vector3.up); currentTarget.GetComponent <CharacterBase>().health += 1; FloatText.CreateFloatText("+1", Color.green, currentTarget.transform.position + 2 * Vector3.up); Debug.Log("HEAL! - " + currentTarget.GetComponent <CharacterBase>().health); CompleteTurn(); special--; } else { FloatText.CreateFloatText("He ded :(", Color.green, currentTarget.transform.position + 2 * Vector3.up); } currentTarget = null; } break; } // decrements special } else { throw new System.Exception("Check if your character can special before specialing. Pooor " + charName); } }
// Update is called once per frame void Update() { if (Obj.name == Manager._selectedName[Control.now_Player] && Control.now_step > 0 && Control.GetState == Control.PlayerState.Start) { anim.SetBool("isSit", false); anim.SetBool("isIdle", false); anim.SetBool("isBow", false); anim.SetBool("isRunning", true); endPoint = GameObject.Find("Block" + Control._playerPossition[Control.now_Player] % 40); transform.position = Vector3.MoveTowards(transform.position, endPoint.transform.position, Time.deltaTime * 8); quad.transform.position = transform.position; quad.transform.position += new Vector3(0, 50, 0); float tmp = Vector3.Distance(Obj.transform.position, endPoint.transform.position); if (tmp == 0) { i++; Control._playerPossition[Control.now_Player]++; if (i > 1) { Control.now_step--; } //左↓ if (Control._playerPossition[Control.now_Player] % 40 == 1 || Control._playerPossition[Control.now_Player] % 40 == 21 || Control._playerPossition[Control.now_Player] % 40 == 23 || Control._playerPossition[Control.now_Player] % 40 == 29) { Obj.transform.rotation = Quaternion.Euler(0, -90, 0); }//上↓ if (Control._playerPossition[Control.now_Player] % 40 == 4 || Control._playerPossition[Control.now_Player] % 40 == 14 || Control._playerPossition[Control.now_Player] % 40 == 22 || Control._playerPossition[Control.now_Player] % 40 == 35 || Control._playerPossition[Control.now_Player] % 40 == 39) { Obj.transform.rotation = Quaternion.Euler(0, 0, 0); }//右↓ if (Control._playerPossition[Control.now_Player] % 40 == 7 || Control._playerPossition[Control.now_Player] % 40 == 12 || Control._playerPossition[Control.now_Player] % 40 == 16 || Control._playerPossition[Control.now_Player] % 40 == 26 || Control._playerPossition[Control.now_Player] % 40 == 36) { Obj.transform.rotation = Quaternion.Euler(0, 90, 0); }//下↓ if (Control._playerPossition[Control.now_Player] % 40 == 10 || Control._playerPossition[Control.now_Player] % 40 == 17 || Control._playerPossition[Control.now_Player] % 40 == 24 || Control._playerPossition[Control.now_Player] % 40 == 28) { Obj.transform.rotation = Quaternion.Euler(0, 180, 0); } } if (Control.now_step == 0) { i = 0; int count1 = 0; Control._playerPossition[Control.now_Player]--; for (int j = 0; j < Manager._countLimit; j++) { if (Control._playerPossition[j] == Control._playerPossition[Control.now_Player]) { count1++; } } if (count1 == 1) { Obj.transform.position += new Vector3(-0.6f, 0, -0.6f); } else if (count1 == 2) { Obj.transform.position += new Vector3(-0.6f, 0, 0.6f); } else if (count1 == 3) { Obj.transform.position += new Vector3(0.6f, 0, -0.6f); } else if (count1 == 4) { Obj.transform.position += new Vector3(0.6f, 0, 0.6f); } Control._playerHp[Control.now_Player] -= 5; //射箭(獲得武器) //監牢 if (Control._playerPossition[Control.now_Player] % 40 == 19) { anim.SetBool("isIdle", false); anim.SetBool("isRunning", false); anim.SetBool("isBow", false); anim.SetBool("isSit", true); } //死亡 else if (Control._playerPossition[Control.now_Player] % 40 == 9) { anim.SetBool("isSit", false); anim.SetBool("isIdle", true); anim.SetBool("isBow", false); anim.SetBool("isRunning", false); } //站立 else { anim.SetBool("isSit", false); anim.SetBool("isRunning", false); anim.SetBool("isBow", false); anim.SetBool("isIdle", true); } FloatText.Click(Obj, 5, "-"); } } }
// Start is called before the first frame update void Start() { // players = teamSelector.players; // IF the player prefs key name is not set, squack at the dev if (playerPrefsKey.Length < 1) { if (debug) { Debug.LogError("'playerPrefsKey' is undefined!"); } } // ELSE... (the player preferences key name is set) else { // Getting the list of players to spawn string toSpawn = PlayerPrefs.GetString(playerPrefsKey); players = new List <string>(toSpawn.Split(',')); Vector3 start = center - separation * (players.Count - 1) / 2; spawnLocations = new Vector3[players.Count]; for (int i = 0; i < players.Count; i++) { spawnLocations[i] = start + i * separation; } turnyBernie.objectList = new List <CharacterBase>(); turnyBernie.spawnPositions = spawnLocations; // Spawning the players for (int num = 0; num < players.Count; num++) { // Defining the current prefab GameObject current = null; // SWITCH for each player type switch (players[num]) { case "Mando": current = mandoPref; break; case "Wook": current = wookPref; break; case "Jed": current = jedPref; break; case "Bo": current = boPref; break; default: if (debug) { Debug.LogError("Prefab type of, '" + players[num] + "' is not defined!"); } break; } // Spawning the current game object in the right spawn location if (current == null) { throw new Exception("Player prefab not found??? The character requested was \"" + players[num] + "\"."); } CharacterBase script = Instantiate(current, spawnLocations[num], Quaternion.identity).GetComponent <CharacterBase>(); playerObjects.Add(script); Instantiate(statPref).GetComponent <StatDisplay>().SetCharacter(script); turnyBernie.objectList.Add(script); } GameObject badddie = GameObject.Find("Rancor"); boss = badddie.GetComponent <CharacterBase>(); Instantiate(statPref).GetComponent <StatDisplay>().SetCharacter(boss); foreach (CharacterBase player in playerObjects) { player.currentEnemy = boss; } turnyBernie.objectList.Add(boss); /* * int startingBossHealth = 25; * for (int x = 0; x < playerObjects.Count - 1; x++) * startingBossHealth -= 5; * * badddie.GetComponent<CharacterBase>().health -= startingBossHealth; */ boss.health = 15 + 5 * (playerObjects.Count); FloatText.CreateFloatText( "Battle start!", new Color(0x7F, 0xFF, 0x00), center + Vector3.up * 2 + Vector3.forward, 8, 1.5f, 0.5f ); } }
/// <summary> /// 設定変更ボタンクリックイベント /// </summary> /// <param name="sender">sender</param> /// <param name="e">e</param> private void btnSettingChange_Click(object sender, EventArgs e) { SettingData setting = SettingData.GetInstance(); DoubleText verticalText = null; DoubleText horizontalText = null; verticalText = (DoubleText)pnlSetting.Controls[0]; horizontalText = (DoubleText)pnlSetting.Controls[1]; if ((verticalText.Value != setting.RobotSize.Vertical) || (horizontalText.Value != setting.RobotSize.Horizontal)) { SizeData size = new SizeData(); size.Vertical = verticalText.Value; size.Horizontal = horizontalText.Value; SetRobotSizeSettingCommand command = new SetRobotSizeSettingCommand(size); command.OnAnalyzed += evRobotSizeSettingChanged; usrCommControl.Send(command); } verticalText = (DoubleText)pnlSetting.Controls[2]; horizontalText = (DoubleText)pnlSetting.Controls[3]; if ((verticalText.Value != setting.FarmSize.Vertical) || (horizontalText.Value != setting.FarmSize.Horizontal)) { SizeData size = new SizeData(); size.Vertical = verticalText.Value; size.Horizontal = horizontalText.Value; SetFarmSizeSettingCommand command = new SetFarmSizeSettingCommand(size); command.OnAnalyzed += evFarmSizeSettingChanged; usrCommControl.Send(command); } if ((setting.KusakariStart.DayOfWeek != (DateTimeSetting.DayOfWeekEnum)usrKusakariStart.DayOfWeek) || (setting.KusakariStart.Hour != usrKusakariStart.Hour) || (setting.KusakariStart.Minulte != usrKusakariStart.Minute)) { DateTimeSetting dt = new DateTimeSetting(); dt.DayOfWeek = (DateTimeSetting.DayOfWeekEnum)usrKusakariStart.DayOfWeek; dt.Hour = usrKusakariStart.Hour; dt.Minulte = usrKusakariStart.Minute; SetStartTimeSettingCommand command = new SetStartTimeSettingCommand(SetStartTimeSettingCommand.ModeEnum.Kusakari, dt); command.OnAnalyzed += evKusakariStartSettingChanged; usrCommControl.Send(command); } if ((setting.YakeiStart.DayOfWeek != (DateTimeSetting.DayOfWeekEnum)usrYakeiStart.DayOfWeek) || (setting.YakeiStart.Hour != usrYakeiStart.Hour) || (setting.YakeiStart.Minulte != usrYakeiStart.Minute)) { DateTimeSetting dt = new DateTimeSetting(); dt.DayOfWeek = (DateTimeSetting.DayOfWeekEnum)usrYakeiStart.DayOfWeek; dt.Hour = usrYakeiStart.Hour; dt.Minulte = usrYakeiStart.Minute; SetStartTimeSettingCommand command = new SetStartTimeSettingCommand(SetStartTimeSettingCommand.ModeEnum.Yakei, dt); command.OnAnalyzed += evYakeiStartSettingChanged; usrCommControl.Send(command); } FloatText moveEndRateText = (FloatText)pnlSetting.Controls[4]; float rate = moveEndRateText.Value / 100.0F; if (setting.MoveEndRate != rate) { SetMoveEndRateCommand command = new SetMoveEndRateCommand(rate); command.OnAnalyzed += evMoveEndRateSettingChanged; usrCommControl.Send(command); } }
public void Grid(GameObject Charactor, Animator anim) //執行格子內容 { if (Control._playerPossition[Control.now_Player] == 0) { Control._playerHp[Control.now_Player] += 300; FloatText.Click(Charactor, 300, "+"); FloatText.story_text("來到這個迷宮不知道多久了,還沒找到全部的裝置...", Manager._selectedName[Control.now_Player] + " Get props "); Time.timeScale = 0; } //過關道具 else if (Control._playerPossition[Control.now_Player] % 40 == 1 ||//1 Control._playerPossition[Control.now_Player] % 40 == 10 || Control._playerPossition[Control.now_Player] % 40 == 20 || Control._playerPossition[Control.now_Player] % 40 == 23 || Control._playerPossition[Control.now_Player] % 40 == 28 || Control._playerPossition[Control.now_Player] % 40 == 32) { int number = -1; if (Control._playerPossition[Control.now_Player] % 40 == 1) { number = 0; } else if (Control._playerPossition[Control.now_Player] % 40 == 10) { number = 1; } else if (Control._playerPossition[Control.now_Player] % 40 == 20) { number = 2; } else if (Control._playerPossition[Control.now_Player] % 40 == 23) { number = 3; } else if (Control._playerPossition[Control.now_Player] % 40 == 28) { number = 4; } else { number = 5; } if (Control._props[number] == true) { FloatText.story_text("發現了鬼火獸的裝置,看著上面的編號好像已經有人拿過了...", Manager._selectedName[Control.now_Player] + " 獲得重複編號為" + (number + 1) + "的鬼火獸裝置"); } else { Control._props[number] = true; FloatText.story_text("發現了鬼火獸的裝置,該趕快回去跟他們會合,和他們說這件事情...", Manager._selectedName[Control.now_Player] + " 得到了上面有著編號" + (number + 1) + "的鬼火獸裝置"); } GameObject.Find("Canvas").GetComponent <Control>().GetProps(); } //獲得武器V else if (Control._playerPossition[Control.now_Player] % 40 == 3 || Control._playerPossition[Control.now_Player] % 40 == 7 || Control._playerPossition[Control.now_Player] % 40 == 13 || Control._playerPossition[Control.now_Player] % 40 == 17 || Control._playerPossition[Control.now_Player] % 40 == 22 || Control._playerPossition[Control.now_Player] % 40 == 30 || Control._playerPossition[Control.now_Player] % 40 == 35 || Control._playerPossition[Control.now_Player] % 40 == 39) { AttackControl.setImage(Charactor); AttackCanvas.enabled = true; MainCanvas.enabled = false; attack = true; } //怪物 else if (Control._playerPossition[Control.now_Player] % 40 == 5 ||//5 Control._playerPossition[Control.now_Player] % 40 == 14 || Control._playerPossition[Control.now_Player] % 40 == 25 || Control._playerPossition[Control.now_Player] % 40 == 36) { Attack.MonsterAttack(GameObject.Find(Manager._selectedName[Control.now_Player])); } //抵擋V else if (Control._playerPossition[Control.now_Player] % 40 == 4 || Control._playerPossition[Control.now_Player] % 40 == 15 || Control._playerPossition[Control.now_Player] % 40 == 27 || Control._playerPossition[Control.now_Player] % 40 == 37) { FloatText.story_text("不知道這裝置能幹什麼用。好像能保護自己的樣子...", Manager._selectedName[Control.now_Player] + " 獲得防禦一次的機會"); Control._held[Control.now_Player] = Control.Shield.Withstand; } //陷阱V else if (Control._playerPossition[Control.now_Player] % 40 == 8 || Control._playerPossition[Control.now_Player] % 40 == 11 || Control._playerPossition[Control.now_Player] % 40 == 18 || Control._playerPossition[Control.now_Player] % 40 == 33) { Attack._Attack(GameObject.Find("Block" + Control._playerPossition[Control.now_Player] % 40)); } //死亡V else if (Control._playerPossition[Control.now_Player] % 40 == 9) { anim.SetBool("isDeath", true); GameObject.Find("Canvas").GetComponent <Control>().next.enabled = true; Control._playerHp[Control.now_Player] = 0; Control._state[Control.now_Player] = Control.PlayerState.Death; } //監牢V else if (Control._playerPossition[Control.now_Player] % 40 == 19) { FloatText.story_text("被同伴發現身上有鬼火獸的傷口。被關在了監牢裡面...", Manager._selectedName[Control.now_Player] + " 暫停一回合 "); Control._state[Control.now_Player] = Control.PlayerState.Sleep; } //隨機移動 else if (Control._playerPossition[Control.now_Player] % 40 == 30) { FloatText.story_text("迷宮突然變換了。走著走著不知道到了那裡...", Manager._selectedName[Control.now_Player] + " 隨機移動 "); Control._playerPossition[Control.now_Player] += Random.Range(1, 39); Charactor.transform.position = GameObject.Find("Block" + Control._playerPossition[Control.now_Player] % 40).transform.position; Grid(Charactor, anim); } //獲得食物v else { Control._playerHp[Control.now_Player] += 200; FloatText.Click(Charactor, 200, "+"); FloatText.story_text("還好有找到食物,不然已經沒東西吃了...", Manager._selectedName[Control.now_Player] + " 取得了食物 ,增加了200點生命"); Time.timeScale = 0; } int count = 0; string name = null; for (int i = 0; i < 6; i++) //計算過關道具是否全部都有 { if (Control._props[i] == true) { count++; } if (count == 6) { FloatText.WinText(Manager._selectedName[Control.now_Player]); Destroy(GameObject.Find("LatticeControl").GetComponent <GridContent>()); } }//計算過關道具是否全部都有↑↑↑ count = 0; for (int i = 0; i < Manager._countLimit; i++) //計算是否剩一位玩家 { if (Control._state[i] != Control.PlayerState.Death) { count++; name = Manager._selectedName[i]; } } if (count == 1) { FloatText.WinText(name); Destroy(GameObject.Find("LatticeControl").GetComponent <GridContent>()); } else { if (Control._playerHp[Control.now_Player] <= 0) { GameObject.Find("GameOver").GetComponent <Image>().enabled = true; } } //計算是否剩一位玩家↑↑↑ }