예제 #1
0
    public void SimulateLaunch(Vector3 direction)
    {
        if (_lastSimulationTime + SimulationInterval > Time.time)
        {
            return;
        }

        Vector3?startPoint = GetProjectileStart(direction);

        if (startPoint == null)
        {
            return;
        }

        PathSimulation projectile = Instantiate(_pathSimulationPrefab, startPoint.Value, Quaternion.Euler(direction));

        projectile.GetComponent <Attractee>().Velocity = direction * LaunchForce;
        SimulatedProjectiles.Add(projectile);
        _lastSimulationTime = Time.time;
    }
예제 #2
0
 void Start()
 {
     _collider             = GetComponent <SphereCollider>();
     _projectilePrefab     = Resources.Load <Rigidbody>("Projectile");
     _pathSimulationPrefab = Resources.Load <PathSimulation>("PathSimulation");
 }