83 lines
2.6 KiB
C#
83 lines
2.6 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class Bonfire_Buildings : Buildings
|
|
{
|
|
[Header("特有内容")]
|
|
public GameObject TuanZi;
|
|
[SerializeField] private List<int> tuanziCosts = new List<int>();
|
|
private int index;
|
|
private float ySpawn = 0.97f;
|
|
private float zSpawn = -5.6f;
|
|
|
|
public override void Start()
|
|
{
|
|
base.Start();
|
|
SpecailBuff_Buildings.BuildingTechItem tmpBTI = new SpecailBuff_Buildings.BuildingTechItem(
|
|
null,GenerateBlob,"诞生团子!", 0, tuanziCosts[tuanziCosts.Count-1], 0,false
|
|
,-1);
|
|
for (int i = tuanziCosts.Count-2; i >= 0; i--)
|
|
{
|
|
SpecailBuff_Buildings.BuildingTechItem cBTI = new SpecailBuff_Buildings.BuildingTechItem(
|
|
tmpBTI, GenerateBlob, "诞生团子!", 0, tuanziCosts[i],0, false
|
|
,-1);
|
|
tmpBTI = cBTI;
|
|
}
|
|
|
|
tmpBTI.firstTech = true;
|
|
InformationPanel.AddTechItem(tmpBTI);
|
|
}
|
|
|
|
public override void AddFunctionToTreeController()
|
|
{
|
|
Action Action1 = BuildingsActive;
|
|
TreeControl.Instance.AddEvent("初始火堆", Action1);
|
|
}
|
|
public override void SpecalUpdate()
|
|
{
|
|
base.SpecalUpdate();
|
|
if (Level==1&&BlobManager.Instance.Blobs.Count > 10)
|
|
{
|
|
BuildingUpgrade(Level);
|
|
Level++;
|
|
}
|
|
}
|
|
public override void AddResources_Click()
|
|
{
|
|
/*int cost;
|
|
if (tuanziCosts.Count > index)
|
|
{
|
|
cost = tuanziCosts[index];
|
|
}
|
|
else
|
|
{
|
|
cost = 10000000;
|
|
}
|
|
if (GameProcedureManager.Instance.WoodCount >= cost)
|
|
{
|
|
//处理花销
|
|
AudioManager.Instance.PlayBlobBornSFX();
|
|
GameProcedureManager.Instance.WoodCount -= cost;
|
|
index++;
|
|
//生成团子
|
|
GameObject new_TuanZi = Instantiate(TuanZi,new Vector3(transform.position.x, transform.position.y, transform.position.z),transform.rotation);
|
|
new_TuanZi.transform.localScale = new Vector3(1, 1, 1);
|
|
new_TuanZi.GetComponent<BlobController>().BelongingBuilding = null;
|
|
}*/
|
|
//Debug.Log("Click_Tree");
|
|
}
|
|
|
|
public void GenerateBlob()
|
|
{
|
|
//处理花销
|
|
AudioManager.Instance.PlayBlobBornSFX();
|
|
index++;
|
|
//生成团子
|
|
GameObject new_TuanZi = Instantiate(TuanZi,new Vector3(transform.position.x, ySpawn, zSpawn),transform.rotation);
|
|
new_TuanZi.transform.localScale = new Vector3(0.7f, 0.7f, 0.7f);
|
|
new_TuanZi.GetComponent<BlobController>().BelongingBuilding = null;
|
|
}
|
|
}
|