예제 #1
0
    /// <summary>
    /// Changes the game's state.
    /// Essentially transitions the screen from one to another one (intro to menu, etc...)
    /// </summary>
    /// <param name="st"></param>
    public void ChangeState(GameStates st)
    {
        Sounder s = Sounder.Instance();

        switch (gameState)
        {
        case GameStates.Prepare:
            s.musicA.Stop();
            break;

        case GameStates.Game:
            s.musicA.Stop();



            Director d = Director.Instance();
            d.Release();


            // ??? <-- It sorta defeats the purpose of making all of those object pools if I just delete them like this...
            RemoveAllThings();
            break;
        }
        //
        if (gameStateMap.ContainsKey(gameState))
        {
            gameStateMap[gameState].SetActive(false);
        }
        //
        gameState = st;
        stateTime = 0;
        //
        ChangeModeState(GameStateModes.Beginning);
        //
        if (gameStateMap.ContainsKey(gameState))
        {
            gameStateMap[gameState].SetActive(true);
        }
        //
        switch (gameState)
        {
        case GameStates.Prepare:
            s.PlayMusic("jazzy");

            Designer de = Designer.Instance();
            de.SetupScreen(Database.Instance().QueryLevelInfo("Level 1"));     // ??? <-- BAD.
            break;

        case GameStates.Game:
            s.PlayMusic("emphasis");



            GameObject go;
            go = new GameObject("Director");
            go.transform.parent = this.transform;
            go.AddComponent <Director>();
            break;
        }
    }
예제 #2
0
    public override void OnSpawn(Actor by = null)
    {
        base.OnSpawn(by);
        //
        tr.Clear();
        power       = 10.0f;
        existPeriod = 2.5f * Helper.SECOND;

        Sounder.Instance().PlaySound("pellet_shoot");
    }
예제 #3
0
    /// <summary>
    /// The core has a special counter-attack that triggers whenever it is attacked.
    /// This minimizes the deadliness of a "swarm" of creeps finding the core.
    /// However, this also means ONE creep is just about as deadly as ten,
    /// since the number of counter-attacks are relative to the amount of attackers.
    /// </summary>
    /// <param name="c"></param>
    public override void OnAttacked(Creep c)
    {
        base.OnAttacked(c);
        //
        Director    d  = Director.Instance();
        EnergyBurst eb = d.CreateDamageArea <EnergyBurst>(Helper.DEADZONE);

        eb.pos = pos;
        eb.OnSpawn();
        // *** This does not get an object pool because there can be ANY number of creeps hitting a core-- And they won't all necessarily be hitting it at once.

        Sounder.Instance().PlaySound("core_damage");
    }
예제 #4
0
 public override void OnHit(Creep c)
 {
     base.OnHit(c);
     //
     Sounder.Instance().PlaySound("pellet_hit_creep");
 }
예제 #5
0
 public override void OnMiss(Obstruction c)
 {
     base.OnMiss(c);
     //
     Sounder.Instance().PlaySound("pellet_hit_wall");
 }