// Start is called before the first frame update
    void Start()
    {
        // Select weapon to use
        // TODO: Create method for selecting the starting weapon
        GameObject weaponPrefab = weapons[0];

        // Instantiate weapon and move to correct location
        // TODO: Move to separate method
        Vector3 weaponPos = new Vector3(transform.position.x, transform.position.y, transform.position.z + 2.0f);

        currentWeapon = Instantiate(weaponPrefab, weaponPos, weaponPrefab.transform.rotation);
        currentWeapon.transform.position = weaponPos;
        currentWeapon.transform.SetParent(transform, true);
        currWeaponInterface = currentWeapon.GetComponent <iWeapon>();
    }
Beispiel #2
0
 public Elf(string in_name, string in_title, int [] stats, iWeapon in_wep, iArmor in_armor, iAction in_attack, iAction in_block, iAction in_evade)
 {
     name   = in_name;
     title  = in_title;
     race   = "Elf";
     Str    = stats[0];
     Dex    = stats[1] + 2;
     Con    = stats[2];
     Int    = stats[3];
     Wis    = stats[4];
     Cha    = stats[5];
     hp     = 10 + Helper.Helper.Mod(Con);
     weapon = in_wep;
     armor  = in_armor;
     AC     = Helper.Helper.AC(this);
     Attack = in_attack;
     Block  = in_block;
     Evade  = in_evade;
 }
    private bool canThrowGrenade = true; // put all this grenade stuff in its own script

    private void Start()
    {
        weapon             = GetComponentInChildren <iWeapon>();
        rb                 = GetComponent <Rigidbody>();
        GameManager.OnEnd += Die;
    }
Beispiel #4
0
 private void FindWeapon()
 {
     weapon            = GetComponentInChildren <iWeapon>();
     weapon.OnFire    += Tick;
     energyConsumption = weapon.GetConsumption();
 }