Esempio n. 1
0
    public override void Throw(Vector2 force, Character thrower)
    {
        base.Throw(force, thrower);

        Throwable[] instadThrowables = new Throwable[additioalThrowables];

        Throwable spawnedThrowable = Throwable.Instantiate <Throwable>(additionalThrowablePrefab);


        spawnedThrowable.transform.position = transform.position + (Vector3.up * 0.5f);
        spawnedThrowable.transform.forward  = force;
        // spawnedThrowable.throwableRigidbody.velocity = force;
        spawnedThrowable.SetVelocity(Quaternion.Euler(0, 0, 15) * force, thrower);
        spawnedThrowable.transform.Rotate(Vector3.left * 10);

        spawnedThrowable = Throwable.Instantiate <Throwable>(additionalThrowablePrefab);
        spawnedThrowable.transform.position = transform.position + (Vector3.down * 0.4f);
        spawnedThrowable.SetVelocity(Quaternion.Euler(0, 0, -15) * force, thrower);
    }
Esempio n. 2
0
    public void ReleaseAllObjects(Vector2 velocity)
    {
        for (int i = 0; i < objectsToStack.Count; i++)
        {
            objectsToStack[i].SetParent(null, true);

            if (objectsToStack[i].GetComponent <Throwable>() != null)
            {
                Throwable throwable = objectsToStack[i].GetComponent <Throwable>();
                throwable.TogglePhysics(true);
                throwable.SetVelocity(velocity);
            }

            objectsToStack.Remove(objectsToStack[i]);
        }
    }