コード例 #1
0
ファイル: Character.cs プロジェクト: tomerbarkan/HomeOffice
    public void Throw(Vector2 force)
    {
        if (cooldownRemaining > 0 || !canShoot)
        {
            return;
        }

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

        spawnedThrowable.transform.position = throwableSpawnPoint.position;
        spawnedThrowable.transform.forward  = force;
        spawnedThrowable.Throw(force, this);
        startCooldown     = (overrideCooldown < 0 ? ConfigManager.instance.cooldown : overrideCooldown) + additionalCooldown;
        cooldownRemaining = startCooldown;
    }
コード例 #2
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);
    }