Hallo an Alle,
Ich sitze gerade an meinem Waffen Script. Ich habe diese Codes dafür verwendet:
using UnityEngine;
using System.Collections;
[system.Serializable()]
public class Weapon : MonoBehaviour {
public string Name;
public int FireRate;
public int MagazinValue;
public int Magazin;
public Transform DrawingObject;
public AudioClip ShootSound;
public int ShootingDistance;
public int Demage;
public Weapon(string Name, int FireRate, int MagazinValue, int Magazin)
{
this.Name = Name;
this.FireRate = FireRate;
this.MagazinValue = MagazinValue;
this.Magazin = Magazin;
}
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
}
als Code für die Waffe gewählt und habe diesen code
using UnityEngine;
using System.Collections;
using System;
[serializable()]
public class Weapons : MonoBehaviour {
// Zeigt eine Liste der Waffen an
public System.Collections.Generic.List<Weapon> Inventory;
// Posisitionen
public decimal PosX;
public decimal PosY;
public decimal PosZ;
public Weapon SelctedWeapon;
// Use this for initialization
void Start () {
this.Inventory = new System.Collections.Generic.List<Weapon> ();
this.Inventory.Add (new Weapon ("Test", 1, 22, 22));
this.SelctedWeapon = this.Inventory[0];
}
// Update is called once per frame
void Update () {
}
}
Zur steuerung für die Waffen gewählt. Allerdings möchte ich nun in der IDE der Liste eine Neue Instantz der Waffe Hinzufügen.
Grüße Andy