本文整理汇总了C#中Weapon.init方法的典型用法代码示例。如果您正苦于以下问题:C# Weapon.init方法的具体用法?C# Weapon.init怎么用?C# Weapon.init使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Weapon
的用法示例。
在下文中一共展示了Weapon.init方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: initWeapons
//Iniciar armes
void initWeapons()
{
Weapon w1 = new Weapon();
Weapon w2 = new Weapon();
//dany, tag model, bales totals, bales carregador, tamany carregador
w1.init(10,"weapon1",100,10,10);
w2.init(25,"weapon2",75,25,25);
weapons.Add(w1);
weapons.Add(w2);
//Arma actual la primera (weapon 1) i les bales que te al carregador
actualWeaponDamage = weapons[posWeapon].getDamage();
balesCarregador = weapons[posWeapon].getBalesActualCarregador();
}
示例2: Instantiate
/* public void makeDrink (Item sc_drink, Vector3 drinkPos){
//todo 미리 뿌려져있는 술과 겹쳐지게 해야함.
TileInfo ti = boardManager._Stage [currStage].get_tileInfo ()[((int)drinkPos.y), ((int)drinkPos.x)];
GameObject go_drink = Instantiate (Resources.Load ("Image_Drink/" + Config.spriteName_Item[sc_drink.GetItemCode()], typeof(GameObject))) as GameObject;
go_drink.transform.position = drinkPos;
ti.i.Add (sc_drink); //Tile Info에 등록
}*/
public void makeItemGO(int itemType, Vector3 itemPos, string resourceName)
{
TileInfo ti = boardManager._Stage [currStage].get_tileInfo ()[((int)itemPos.y), ((int)itemPos.x)];
if (itemType < 0) { //골드일 경우
GameObject go_gold = Instantiate (Resources.Load (resourceName, typeof(GameObject))) as GameObject;
go_gold.GetComponent<ObjectID> ().secondCode = -itemType;
go_gold.transform.position = itemPos;
go_gold.GetComponent<SpriteRenderer> ().sortingOrder = ti.i.Count+ti.d.Count; //소팅 레이어 등록
Gold sc_gold = new Gold ();
sc_gold.SetGameObject (go_gold);
sc_gold.init (-1, -itemType, 0);
// Debug.Log("make Item in " + itemPos.x + "," + itemPos.y);
ti.i.Add (sc_gold); //Tile Info에 드랍 골드 등록
} else {
switch(itemType){
case 0: //drink
Debug.Log("Can't make drink here");
break;
case 1: //weapon
GameObject go_weapon = Instantiate (Resources.Load (resourceName, typeof(GameObject))) as GameObject;
go_weapon.transform.position = itemPos;
go_weapon.GetComponent<SpriteRenderer> ().sortingOrder = ti.i.Count+ti.d.Count; //소팅 레이어 등록
Weapon sc_weapon = new Weapon();
sc_weapon.SetGameObject (go_weapon);
ObjectID weaponId = go_weapon.GetComponent<ObjectID>();
sc_weapon.init (weaponId.firstCode, weaponId.secondCode, weaponId.thirdCode);
ti.i.Add (sc_weapon); //Tile Info에 등록
break;
case 2: //accessory
GameObject go_acce = Instantiate (Resources.Load (resourceName, typeof(GameObject))) as GameObject;
go_acce.transform.position = itemPos;
go_acce.GetComponent<SpriteRenderer> ().sortingOrder = ti.i.Count+ti.d.Count; //소팅 레이어 등록
Accessory sc_acce = new Accessory();
sc_acce.SetGameObject (go_acce);
ObjectID acceId = go_acce.GetComponent<ObjectID>();
sc_acce.init (acceId.firstCode, acceId.secondCode, acceId.thirdCode);
ti.i.Add (sc_acce); //Tile Info에 등록
break;
case 3: //snack
GameObject go_snack = Instantiate (Resources.Load (resourceName, typeof(GameObject))) as GameObject;
go_snack.transform.position = itemPos;
go_snack.GetComponent<SpriteRenderer> ().sortingOrder = ti.i.Count+ti.d.Count; //소팅 레이어 등록
Snack sc_snack = new Snack();
sc_snack.SetGameObject (go_snack);
ObjectID snackId = go_snack.GetComponent<ObjectID>();
sc_snack.init (snackId.firstCode, snackId.secondCode, snackId.thirdCode);
ti.i.Add (sc_snack); //Tile Info에 등록
break;
case 4: //alcoholBag
GameObject go_abg = Instantiate (Resources.Load (resourceName, typeof(GameObject))) as GameObject;
go_abg.transform.position = itemPos;
go_abg.GetComponent<SpriteRenderer> ().sortingOrder = ti.i.Count+ti.d.Count; //소팅 레이어 등록
AlcoholBag sc_abg = new AlcoholBag();
sc_abg.SetGameObject (go_abg);
ObjectID abgId = go_abg.GetComponent<ObjectID>();
sc_abg.init (abgId.firstCode, abgId.secondCode, abgId.thirdCode);
ti.i.Add (sc_abg); //Tile Info에 등록
break;
case 5: //alcoholBottle
GameObject go_abt = Instantiate (Resources.Load (resourceName, typeof(GameObject))) as GameObject;
go_abt.transform.position = itemPos;
go_abt.GetComponent<SpriteRenderer> ().sortingOrder = ti.i.Count+ti.d.Count; //소팅 레이어 등록
AlcoholBottle sc_abt = new AlcoholBottle();
sc_abt.SetGameObject (go_abt);
ObjectID abtId = go_abt.GetComponent<ObjectID>();
sc_abt.init (abtId.firstCode, abtId.secondCode, abtId.thirdCode);
ti.i.Add (sc_abt); //Tile Info에 등록
break;
}
}
}
示例3: Update
void Update()
{
if (Input.GetKeyDown (KeyCode.Keypad1)) {
Weapon tempItem = new Weapon();
tempItem.init(2,2,2);
AddItem(tempItem);
}
if (Input.GetKeyDown (KeyCode.Keypad2)) {
Drink tempItem = new Drink();
tempItem.init(temp++);
AddDrink(tempItem);
}
}