public override void Cast(SpellCasting caster)
    {
        //raycast to the floor
        RaycastHit hit;

        if (caster.RaycastFromWandDefaultMask(out hit))
        {
            Debug.Log($"Levitating {hit.transform.gameObject.name}");
            levitating = hit.transform.gameObject;
            if (levitating?.GetComponent <LevitateableController>() == null)
            {
                return;
            }
            hit.transform.parent = caster.gameObject.transform;
            levitatingRB         = levitating.GetComponent <Rigidbody>();
            if (levitatingRB != null)
            {
                levitatingRB.useGravity = false;
            }
        }
        else
        {
            Debug.Log("Failed to levitate anything");
        }
    }
Ejemplo n.º 2
0
    public override void Cast(SpellCasting caster)
    {
        Debug.Log("Casting a flame spell");
        this.caster = caster;
        RaycastHit hit = default(RaycastHit);

        if (caster.RaycastFromWandDefaultMask(out hit))
        {
            burningObjController = hit.transform.gameObject.GetComponent <FlammableController>();
            burningObjController?.LightOnFire(this);
        }

        Debug.Log($"Hit {hit.transform?.gameObject?.name}, burning controller ? {burningObjController}");
    }
    public override void Cast(SpellCasting caster)
    {
        Debug.Log("teleportspell being cast");
        //raycast to the floor
        RaycastHit hit;

        if (caster.RaycastFromWandDefaultMask(out hit))
        {
            if (hit.transform?.gameObject?.GetComponent <TeleportableController>() == null)
            {
                Debug.Log("no teleport controller"); return;
            }

            Debug.Log($"moving camera to {hit.point}");
            caster.CameraRig.transform.position = hit.point;
        }
        caster.CurrentSpellsCast.Remove(this);
    }