Ejemplo n.º 1
0
    public override ShipController CreateShip(ShipModel shipModel)
    {
        var playerShipObject = Spawner.Spawn(AssetLibrary.AssetSet.ShipPrefab.gameObject, Vector3.zero, Quaternion.identity);

        PlayerShip = playerShipObject.GetComponent <ShipController>();
        PlayerShip.Initialize(shipModel, Spawner, Camera);
        PlayerShip.OnShipDestruction += OnShipDestruction;
        return(PlayerShip);
    }
Ejemplo n.º 2
0
    public void UpdateValue(int value)
    {
        if (_list.Count == value)
        {
            return;
        }

        if (_list.Count < value)
        {
            for (int i = _list.Count; i < value; i++)
            {
                var spawned = Spawner.Spawn(Template, transform);
                _list.Add(spawned);
            }
        }
        else if (_list.Count > 0)
        {
            for (int i = _list.Count - 1; value < _list.Count; i--)
            {
                var spawned = _list[i];
                _list.RemoveAt(i);
                Spawner.Despawn(spawned);
            }
        }
    }
Ejemplo n.º 3
0
    public void Fire()
    {
        if (Time.time < _gunCooldownFinishTime)
        {
            return;
        }
        _gunCooldownFinishTime = Time.time + (1 / _fireRate);

        var shot = _spawner.Spawn(Shot.gameObject, transform.position, Quaternion.LookRotation(transform.forward, transform.up));

        shot.GetComponent <ShotController>().Initialize(_spawner, _camera, gameObject.layer);
    }