public void SaveTowerPreset(int towerNum, string name, int headType, int baseType) // add more in here for passins. { try { switch (towerNum) { case 1: towerOne = new TowerObject(); towerOne.SetTowerName(name); towerOne.SetTowerHeadType(headType); towerOne.SetTowerBaseType(baseType); //towerOne. add aprameters in the function call. break; case 2: towerTwo = new TowerObject(); towerTwo.SetTowerName(name); towerTwo.SetTowerHeadType(headType); towerTwo.SetTowerBaseType(baseType); break; case 3: towerThree = new TowerObject(); towerThree.SetTowerName(name); towerThree.SetTowerHeadType(headType); towerThree.SetTowerBaseType(baseType); break; } } catch (Exception e) { //print(e.Message.ToString()); } }
public TowerObject CreateTower() { TowerObject t = new TowerObject(); t.Entity.transform.localPosition = new Vector3(0, 0); return(t); }
TowerDisplay Instance(Transform spawnPoint, TowerObject towerObject) { var spawningPosition = spawnPoint.position; var instance = Instantiate <TowerDisplay> (towerObject.displayPrefab, spawningPosition, Quaternion.identity); instance.towerObject = towerObject; return(instance); }
public void SetStats(TowerObject stats) { projectileSpeed = stats.projectileSpeed; projectileDamage = stats.projectileDamage; coolDown = stats.coolDown; mode = stats.mode; range = stats.range; }
public static void Create() { TowerObject asset = ScriptableObject.CreateInstance <TowerObject>(); AssetDatabase.CreateAsset(asset, "Assets/NewTowerObject.asset"); AssetDatabase.SaveAssets(); EditorUtility.FocusProjectWindow(); Selection.activeObject = asset; }
public void ClickTowerImage() { towerObj = EventSystem.current.currentSelectedGameObject.GetComponent <TowerObject>();//눌러진 이미지버튼 객체를 가져옴 towerImageView.sprite = gm.LoadImageToSprite(towerObj.towerObjInfo.towerImagePath); projectileImageView.sprite = gm.LoadImageToSprite(towerObj.towerObjInfo.projectileImagePath); attackDamage.text = towerObj.towerObjInfo.attackDamage.ToString(); attackSpeed.text = towerObj.towerObjInfo.attackSpeed.ToString(); cost.text = towerObj.towerObjInfo.cost.ToString(); }
//towerobjectinformation을 가진 버튼으로 나오도록 교체 void LoadTowerObjectList() { GameManager.gameManager.LoadTowerObjectList(Application.persistentDataPath + GameManager.gameManager.towerObjectPath, towerObjInfoList); GameObject InteractableImageButtonPrefab = Resources.Load <GameObject>("Prefab/DrawingScreen/CreatingTower/CreatingTowerPreset/타워객체"); for (int i = 0; i < towerObjInfoList.Count; i++) { GameObject InteractableImageButton = Instantiate(InteractableImageButtonPrefab, objectScrollView); TowerObject towerObj = InteractableImageButton.GetComponent <TowerObject>(); towerObj.towerObjInfo = towerObjInfoList[i]; InteractableImageButton.GetComponent <Image>().sprite = GameManager.gameManager.LoadImageToSprite(towerObj.towerObjInfo.towerImagePath); InteractableImageButton.GetComponent <Button>().onClick.AddListener(ClickTowerImage);//버튼에 리스너 부착 interactableButtons.Add(InteractableImageButton); } }