public void SetBehaviour(int i) { if ((i < behaviourList.Count) && (behaviourList[i] != null)) { currentBehaviour = behaviourList[i]; } }
public void Control(IShipFiringBehaviour behaviour) { if (Input.GetButton("Fire1")) { behaviour.Fire(); } }
private ShipFiringBehavioursManager behaviourManager; //se encarga de switchear el behaviour private void Awake() { //Disparo comun behaviour, construccion y builder behaviourList.Add(new ShipFiringBehaviourAutomatic(bulletSource) .SetBulletInterval(normalBulletInterval).SetBulletDuration(normalBulletLifetime) .SetBulletSpeed(normalBulletSpeed)); //Disparo bomba behaviour, construccion y builder behaviourList.Add(new ShipFiringBehaviourBombAutomatic(bulletSource) .SetExplosionRadius(bombBulletRadius).SetBulletInterval(bombBulletInterval) .SetBulletDuration(bombBulletLifetime).SetBulletSpeed(bombBulletSpeed)); //Disparo laser behaviour, construccion y builder //Marcos: Si extendes/modificas algun builder o construccion, acordate de ajustar aca. behaviourList.Add(new ShipFiringBehaviourLaser(bulletSource).SetLaserRange(laserBulletRange).SetLaserWidth(laserBulletWidth)); behaviourManager = new ShipFiringBehavioursManager(this); currentBehaviour = behaviourList[0]; controller = new ShipFiringControllerPlayer(); }