Ejemplo n.º 1
0
 void Start()
 {
     _playerMovement                      = GetComponent <PlayerMovementBehaviour>();
     _playerShootBehaviour                = GetComponent <PlayerShootBehaviour>();
     _projectileSpawnerBehaviour          = GetComponent <ProjectileSpawnerBehaviour>();
     _playerControls.Ship.Fire.performed += context => _projectileSpawnerBehaviour.Fire();
 }
    public bool ApplyPowerUp(GameObject obj)
    {
        // Ensure obj has a projectile spawner and get a reference to it
        ProjectileSpawnerBehaviour spawner = obj.GetComponentInParent <ProjectileSpawnerBehaviour>();

        if (spawner == null)
        {
            return(false);
        }

        switch (_changeType)
        {
        // If the type is additive, add the fire delay change
        case ChangeType.ADDITIVE:
            spawner.FireDelay += _fireDelayChange;
            return(true);

        // If the type is percentile, multiply the fire delay change
        case ChangeType.MULTIPLICATIVE:
            spawner.FireDelay *= _fireDelayChange;
            return(true);

        // If somehow neither is true, return false
        default:
            return(false);
        }
    }
 public void addSpawnerBehaviour(ProjectileSpawnerBehaviour b)
 {
     b.applySpawnerModifications(this);
     b.transform.parent = transform;
     behaviours.Add(b);
 }
Ejemplo n.º 4
0
 public void addSpawnerBehaviour(ProjectileSpawnerBehaviour b)
 {
     weapon.addSpawnerBehaviour(b);
 }
 // Start is called before the first frame update
 void Start()
 {
     _gun              = GetComponent <ProjectileSpawnerBehaviour>();
     _playerMovement   = GetComponent <PlayerMovementBehaviour>();
     _initialMoveSpeed = _playerMovement.MoveSpeed;
 }