Exemplo n.º 1
0
    public override void OnSpellChangedFrom()
    {
        if (liftedObject != null)
        {
            if (objectGrabbed)
            {
                liftedObject.ThrowAtTarget(liftedObject.transform.position);
            }

            else if (objectLifted)
            {
                liftedObject.EndLevitate();
            }
        }


        objectGrabbed  = false;
        objectLifted   = false;
        buttonHeld     = false;
        timeButtonHeld = 0;
        liftedObject   = null;


        spellChargeParticleModule.ClearAllEffects();
    }
Exemplo n.º 2
0
    public override void AttackPressed(Vector3 spawnPosition, Vector3 spawnDirection, Vector3?targetPosition = null)
    {
        buttonHeld = true;

        if (objectGrabbed)
        {
            if (targetPosition.HasValue)
            {
                liftedObject.ThrowAtTarget(targetPosition.Value);
            }
            else
            {
                liftedObject.ThrowInDirection(spawnDirection);
            }
            liftedObject  = null;
            objectGrabbed = false;
        }

        else
        {
            RaycastHit hitInfo;
            if (Physics.Raycast(spawnPosition, spawnDirection, out hitInfo))
            {
                LevitatableObject newLiftedObject = hitInfo.collider.GetComponent <LevitatableObject>();
                if (newLiftedObject == null)
                {
                    return;
                }

                if (objectLifted && newLiftedObject == liftedObject)
                {
                    liftedObject.EndLevitate();
                    objectLifted = false;
                }
                else if (playerStatus.UseMana(castManaCost))
                {
                    if (objectLifted)
                    {
                        liftedObject.EndLevitate();
                    }
                    objectLifted = true;
                    liftedObject = newLiftedObject;
                    liftedObject.Levitate();
                }
            }
        }
    }
Exemplo n.º 3
0
    public override void AttackReleased(Vector3 spawnPosition, Vector3 spawnDirection, Vector3?targetPosition = null)
    {
        buttonHeld     = false;
        timeButtonHeld = 0;

        if (!objectLifted && !objectGrabbed)
        {
            liftedObject = null;
        }

        if (liftedObject)
        {
            spellChargeParticleModule.ClearParticleEffects();
        }
        else
        {
            spellChargeParticleModule.ClearAllEffects();
        }
    }