示例#1
0
文件: Sidebar.cs 项目: Kwing95/kabel
    // Pauses the player and all enemies (does not modify timeScale)
    public void ActionPause(bool paused)
    {
        actionPaused = paused;

        // Necessary for message dialogue
        pauseDimmer.targetAlpha = paused ? 0.5f : 0;

        RefreshAllActionButtons();

        PlayerMover.instance.enabled = !paused;

        List <GameObject> enemyList = ObjectContainer.GetEnemiesAndWounded();

        foreach (GameObject unit in enemyList)
        {
            AutoMover autoMover = unit.GetComponent <AutoMover>();
            if (autoMover != null)
            {
                autoMover.enabled = !paused;
            }

            HideMover hideMover = unit.GetComponent <HideMover>();
            if (hideMover != null)
            {
                hideMover.enabled = !paused;
            }

            Airship airship = unit.GetComponent <Airship>();
            if (airship != null)
            {
                airship.enabled = !paused;
            }
        }

        List <GameObject> projectiles = ObjectContainer.GetAllProjectiles();

        foreach (GameObject projectile in projectiles)
        {
            Projectile proj = projectile.GetComponent <Projectile>();
            if (proj != null)
            {
                proj.enabled = !paused;
            }
        }
    }