public override bool Attach(UnderBarrel input) { underBarrel = input; input.transform.position = transform.position; input.transform.parent = transform; input.receiver = this; return(false); }
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); }
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); } }
/** * @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); }
public void AddToInventory(UnderBarrel input) { underBarrels.Add(input); FindObjectOfType <AudioManager>().Play("pickup"); input.transform.parent = transform; }
public virtual bool Attach(UnderBarrel input) { return(false); }
public void AddToInventory(UnderBarrel input) { underBarrels.Add(input); input.transform.parent = transform; }