void Start() { g_game_Con_Script = GameObject.Find("Game_Controller").GetComponent <Game_Controller>(); g_player_sporn = GameObject.Find("Player_Controller").GetComponent <Playercontroller>(); g_hintScript = GameObject.Find("Stageinformation").GetComponent <HintScript>(); g_dice_create_Script = this.GetComponent <Dice_Create>(); }
//消耗能量 public bool ConsumeAP(float _value, bool _nowConsumer) { if (playerData.Ap_original - _value >= 0) { if (_nowConsumer) { playerData.Ap_original -= _value; leftTopPowerBar.fillAmount = playerData.Ap_original / playerData.Ap_Max; } return(true); } else { HintScript.CreatHint("能量不足"); return(false); } }
///////////////////////////////////////蓋塔防相關 public void NeedToUpdate() { if (nowBuilding && haveTower) { if (nowSelect) { FindCorrectPos(); } if (!nowBuild) { if (Input.GetMouseButtonDown(1)) { print("取消建造"); cancelSelect(); _start = false; } if (_start && !nowSelect) { goBuild(); } } else { if ((Input.GetKeyDown(KeyCode.Escape)) || Input.GetMouseButtonDown(1) || playerScript.deadManager.checkDead) { nowBuild = false; if (cancelBuildIndex != 0) { MatchTimeManager.ClearThisTask(cancelBuildIndex); } cancelBuildIndex = 0; playerScript.switchScaffolding(false); cancelPunish(0.8f); closeScaffolding(); closeTurretToBuild(); playerScript.stopAnything_Switch(false); HintScript.CreatHint("中斷建造"); } } } }
void FindCorrectPos() { gridPosScript.NeedToUpdate(); if (EventSystem.current.IsPointerOverGameObject()) { return; } if (Input.GetMouseButtonDown(0)) { if (ifCanBuild) { NodePos = gridPosScript.nodePos(); nowNotSelectSwitch(false); if (Vector3.SqrMagnitude(NodePos - builder.position) <= (turretToBuild.turret_buildDistance * turretToBuild.turret_buildDistance)) { Payment(); playerScript.stopAnything_Switch(true); openScaffolding(NodePos); playerScript.switchScaffolding(true); DelayToBuild(); } else { creatTmpObj(NodePos); playerScript.getTatgetPoint(NodePos); _start = true; Debug.Log("距離過遠"); } } else { HintScript.CreatHint("此處不能建造"); } } }
private void Start() { g_hintScript = GameObject.Find("Stageinformation").GetComponent <HintScript>(); g_hintImage = GetComponent <Image>(); }
// Use this for initialization void Start() { HintScript = GameObject.FindObjectOfType <HintScript>(); }
void Awake() { Instance = this; InputBlocker.SetActive(false); }