コード例 #1
0
    private void OnTriggerEnter2D(Collider2D other)
    {
        ProjectileBehaviour otherProjectileObject = other.GetComponent <ProjectileBehaviour>();

        if (otherProjectileObject != null && otherProjectileObject.health > 0)
        {
            if (otherProjectileObject.GetDamage(1))
            {
                GameController.instance.lineRenderer.gameObject.GetComponent <MouseMovement>().oneSwipeKillsCounter += 1;
                GameController.instance.IncreaseKills(1);

                if (GameController.instance.lineRenderer.gameObject.GetComponent <MouseMovement>().oneSwipeKillsCounter > 2)
                {
                    streakController.ShowStreak(GameController.instance.lineRenderer.gameObject.GetComponent <MouseMovement>().oneSwipeKillsCounter);
                }
            }
        }
    }
コード例 #2
0
ファイル: MouseMovement.cs プロジェクト: LicBoy/2D-Game
    private void OnTriggerEnter2D(Collider2D other)
    {
        ProjectileBehaviour otherProjectileObject = other.GetComponent <ProjectileBehaviour>();

        if (otherProjectileObject != null && otherProjectileObject.health > 0)
        {
            killedProj = otherProjectileObject.GetDamage(lineDamage);
            if (killedProj)
            {
                oneSwipeKillsCounter += 1;
                GameController.instance.IncreaseKills(oneSwipeKillsCounter);
                linerend.widthMultiplier *= oneSwipeKillsCounter;
                linerend.widthMultiplier  = Mathf.Clamp(linerend.widthMultiplier, curveWidthMultiplayer, curveWidthMultiplayer * 3);
                if (oneSwipeKillsCounter > 2)
                {
                    StreakUIController.ShowStreak(oneSwipeKillsCounter);
                    if (vampirismBonusActive)
                    {
                        GameController.instance.player.Heal(vampirismHealAmount);
                    }
                }
            }
        }
    }