コード例 #1
0
    private void FireProjectile()
    {
        AudioManager.Instance.PlaySoundVaried("ToadSpit");

        attackTimer = attackCooldown;
        MossHurlerProjectile projectile = Instantiate(projectilePrefab, projectileCreationTransform.position, projectileCreationTransform.rotation, null).GetComponent <MossHurlerProjectile>();

        projectile.GetComponent <Rigidbody>().velocity = projectile.transform.forward * projectileSpeed;
        projectile.damage = this.damage;

        Vector3 projScale = projectile.transform.localScale;

        projectile.transform.localScale = projScale * 0.1f;

        projectile.transform.DOScale(projScale, 0.5f).SetEase(Ease.OutElastic);
    }
コード例 #2
0
    private void OnTriggerEnter(Collider other)
    {
        Chunk chunk = other.GetComponent <Chunk>();

        if (chunk)
        {
            chunk.DestroyQuiet();
        }

        MossHurlerProjectile mossHurlerProjectile = other.GetComponent <MossHurlerProjectile>();

        if (mossHurlerProjectile)
        {
            mossHurlerProjectile.DestroyProjectile();
        }
    }