Esempio n. 1
0
 public override bool Attach(UnderBarrel input)
 {
     underBarrel = input;
     input.transform.position = transform.position;
     input.transform.parent   = transform;
     input.receiver           = this;
     return(false);
 }
Esempio n. 2
0
    public override UnderBarrel DetachUnderBarrel()
    {
        UnderBarrel ToReturn = underBarrel;

        underBarrel.transform.parent = null;
        underBarrel = null;
        readyForUse = false;
        return(ToReturn);
    }
    /**
     * @pre: None.
     * @post: Gun's parts should be rolled, ready for stats to be calculated.
     * @param: None.
     * @return: Stub for now, should return if build occurs with no issues function returns correctly.
     */

    public override bool BuildGun()
    {
        ammo           = Instantiate(RollAmmo(), this.transform);
        barrel         = Instantiate(RollBarrel(), this.transform);
        caliber        = Instantiate(RollCaliber(), this.transform);
        cyclicModifier = Instantiate(RollCyclicModifier(), this.transform);
        cyclicModifier.Attach(this);
        magazine    = Instantiate(RollMagazine(), this.transform);
        sight       = Instantiate(RollSight(), this.transform);
        stock       = Instantiate(RollStock(), this.transform);
        underBarrel = Instantiate(RollUnderBarrel(), this.transform);
        underBarrel.Attach(this);
        return(true);
    }
Esempio n. 4
0
 public UnderBarrel TakeUnderBarrelFromInventory(int index)
 {
     if (index <= underBarrels.Count - 1)
     {
         UnderBarrel returnItem = underBarrels[index];
         underBarrels.RemoveAt(index);
         return(returnItem);
     }
     else
     {
         UnderBarrel returnItem = underBarrels[underBarrels.Count - 1];
         underBarrels.RemoveAt(underBarrels.Count - 1);
         return(returnItem);
     }
 }
Esempio n. 5
0
    /**
     * @pre: None.
     * @post: Gun's parts should be rolled, ready for stats to be calculated.
     * @param: None.
     * @return: Stub for now, should return if build occurs with no issues function returns correctly.
     */

    public override bool BuildGun()
    {
        parts          = new GunPart[NUM_PARTS];
        ammo           = Instantiate(RollAmmo(), this.transform);
        barrel         = Instantiate(RollBarrel(), this.transform);
        caliber        = Instantiate(RollCaliber(), this.transform);
        cyclicModifier = Instantiate(RollCyclicModifier(), this.transform);
        cyclicModifier.Attach(this);
        magazine    = Instantiate(RollMagazine(), this.transform);
        sight       = Instantiate(RollSight(), this.transform);
        stock       = Instantiate(RollStock(), this.transform);
        underBarrel = Instantiate(RollUnderBarrel(), this.transform);
        underBarrel.Attach(this);
        readyForUse = true;
        CalculateStats();
        return(true);
    }
Esempio n. 6
0
 public void AddToInventory(UnderBarrel input)
 {
     underBarrels.Add(input);
     FindObjectOfType <AudioManager>().Play("pickup");
     input.transform.parent = transform;
 }
Esempio n. 7
0
 public virtual bool Attach(UnderBarrel input)
 {
     return(false);
 }
Esempio n. 8
0
 public void AddToInventory(UnderBarrel input)
 {
     underBarrels.Add(input);
     input.transform.parent = transform;
 }