Ejemplo n.º 1
0
    protected void DoCreateProjectile(Transform origin)
    {
        // Because the weapon fire point and the aiming point wasn't same,
        // We need to correct its trajectory.
        Transform weaponFireTransform = weaponEffectPoint.transform;
        Vector3   correctionVector    = weaponFireTransform.InverseTransformVector(origin.position - weaponEffectPoint.position);

        correctionVector.z = 0;

        GameObject     obj  = Instantiate(projectilePrefab, weaponEffectPoint.position, origin.rotation);
        BaseProjectile proj = obj.GetComponent <BaseProjectile>();

        proj.InitData(this, weaponFireTransform.rotation, correctionVector);
    }