示例#1
0
    public override void OnInspectorGUI()
    {
        PointsSpawner enemiesPatrolPoints = (PointsSpawner)target;

        // Button:
        string   buttonName  = enemiesPatrolPoints.CreateNewPoints ? "Stop creating new points" : "Create new points";
        GUIStyle buttonStyle = new GUIStyle(GUI.skin.button);

        if (enemiesPatrolPoints.CreateNewPoints)
        {
            buttonStyle.normal.textColor = Color.red;
            buttonStyle.active.textColor = Color.red;
            buttonStyle.fontStyle        = FontStyle.Bold;
        }

        if (GUILayout.Button(buttonName, buttonStyle))
        {
            if (!enemiesPatrolPoints.CreateNewPoints)
            {
                enemiesPatrolPoints.StartCreatingNewPoints();
            }
            else
            {
                enemiesPatrolPoints.StopCreatingNewPoints();
            }
        }

        // Help box:
        if (enemiesPatrolPoints.CreateNewPoints)
        {
            EditorGUILayout.HelpBox("Click a left mouse button on the scene view to set a new point.", MessageType.Info);
        }
    }
示例#2
0
    public override void _Ready()
    {
        player      = GetNode <Player>("Player");
        enemiesNode = GetNode <Node2D>("Enemies");
        pauseMenue  = GetNode <Control>("Hud/PauseMenue");

        gunSpawner        = new GunSpawner();
        enemySpawner      = new EnemySpawner(enemiesNode);
        pointsSpawner     = new PointsSpawner(pointsScene);
        consumableSpawner = new ConsumableSpawner(healthPackScene, energyDrinkScene, GetTree().CurrentScene);

        gunSpawner.InitGun <Pistol>(ref pistol, pistolScene);
        gunSpawner.InitGun <Shotgun>(ref shotgun, shotGunScene);
        gunSpawner.InitGun <RocketLauncher>(ref rocketLauncher, rocketLauncherScene);

        SpawnGuns();
        SpawnEnemies();

        if (IsPaused)
        {
            ResumeGame();
        }
    }
示例#3
0
 private void Start()
 {
     instance = this;
 }