Exemplo n.º 1
0
 void OnDisable()
 {
     EventKit.Unsubscribe <bool>("level completed", OnLevelCompleted);
     EventKit.Unsubscribe <int, Weapon.WeaponType>("player dead", OnPlayerDead);
 }
Exemplo n.º 2
0
 void OnDestroy()
 {
     EventKit.Unsubscribe <bool>("save game data", OnSaveGameData);
     EventKit.Unsubscribe <bool>("load game data", OnLoadGameData);
 }
 void OnDestroy()
 {
     EventKit.Unsubscribe <Hit>("player dead", OnPlayerDead);
 }
Exemplo n.º 4
0
 void OnEnable()
 {
     EventKit.Subscribe <int>("init score", OnInitScore);
     EventKit.Subscribe <int>("change score", OnChangeScore);
     EventKit.Subscribe <bool>("fade hud", OnFadeHud);
 }
Exemplo n.º 5
0
 //Clean up eventTable every time a new level loads.
 public void SceneLoaded(int unused)
 {
     EventKit.Cleanup();
 }
Exemplo n.º 6
0
 void Awake()
 {
     _attackDisabled = disableAttack;
     EventKit.Broadcast("wake singletons");
 }
Exemplo n.º 7
0
 void OnPrizeCollected(int worth)
 {
     gameData.CurrentScore += worth;
     EventKit.Broadcast <int>("change score", gameData.CurrentScore);
 }
Exemplo n.º 8
0
 void OnEnable()
 {
     EventKit.Subscribe <int>("init lvl", OnInitInteger);
     EventKit.Subscribe <bool>("fade hud", OnFadeHud);
 }
Exemplo n.º 9
0
 void OnDestroy()
 {
     EventKit.Unsubscribe <int>("init lvl", OnInitInteger);
     EventKit.Unsubscribe <bool>("fade hud", OnFadeHud);
 }
Exemplo n.º 10
0
 void OnDestroy()
 {
     EventKit.Unsubscribe <int, Weapon.WeaponType>("player dead", OnPlayerDead);
 }
Exemplo n.º 11
0
 void OnDestroy()
 {
     EventKit.Unsubscribe <GameObject, Side>("init stashed weapon", OnInitStashedWeapon);
     EventKit.Unsubscribe <GameObject, Side>("change stashed weapon", OnChangeStashedWeapon);
     EventKit.Unsubscribe("reposition hud elements", SetTweens);
 }
Exemplo n.º 12
0
 void OnEnable()
 {
     EventKit.Subscribe <int, Weapon.WeaponType>("player dead", OnPlayerDead);
 }
 void OnDestroy()
 {
     EventKit.Unsubscribe <int>("set screen size", SetOrthographicSize);
 }
 void OnEnable()
 {
     EventKit.Subscribe <int>("set screen size", SetOrthographicSize);
 }
Exemplo n.º 15
0
 void OnEnable()
 {
     EventKit.Subscribe <int>("init hp", OnInitHP);
     EventKit.Subscribe <int>("reduce hp", OnReduceHP);
     EventKit.Subscribe <bool>("fade hud", OnFadeHud);
 }
Exemplo n.º 16
0
 void OnEnable()
 {
     EventKit.Subscribe <bool>("player above ground", OnPlayerAboveGround);
 }
Exemplo n.º 17
0
 void OnDestroy()
 {
     EventKit.Unsubscribe <int>("init hp", OnInitHP);
     EventKit.Unsubscribe <int>("reduce hp", OnReduceHP);
     EventKit.Unsubscribe <bool>("fade hud", OnFadeHud);
 }
Exemplo n.º 18
0
 void OnDisable()
 {
     EventKit.Unsubscribe <bool>("player above ground", OnPlayerAboveGround);
 }
Exemplo n.º 19
0
 void Start()
 {
     gameData = GameObject.Find(_DATA).GetComponent <GameData>();
     EventKit.Broadcast <int>("init score", gameData.CurrentScore);
 }
Exemplo n.º 20
0
 void OnDisable()
 {
     EventKit.Unsubscribe <bool>("level completed", OnLevelCompleted);
     EventKit.Unsubscribe <Hit>("player dead", OnPlayerDead);
 }
Exemplo n.º 21
0
 void OnDestroy()
 {
     EventKit.Unsubscribe <int>("prize collected", OnPrizeCollected);
     EventKit.Unsubscribe <int, Weapon.WeaponType>("player dead", OnPlayerDead);
     EventKit.Unsubscribe <bool>("level completed", OnLevelCompleted);
 }
 void OnEnable()
 {
     EventKit.Subscribe <bool>("fade hud", OnFadeHud);
 }
Exemplo n.º 23
0
 void OnDestroy()
 {
     EventKit.Unsubscribe <int>("init score", OnInitScore);
     EventKit.Unsubscribe <int>("change score", OnChangeScore);
     EventKit.Unsubscribe <bool>("fade hud", OnFadeHud);
 }
 void OnDestroy()
 {
     EventKit.Unsubscribe <bool>("fade hud", OnFadeHud);
 }
Exemplo n.º 25
0
 void OnEnable()
 {
     EventKit.Subscribe <bool>("save game data", OnSaveGameData);
     EventKit.Subscribe <bool>("load game data", OnLoadGameData);
 }
Exemplo n.º 26
0
 void OnApplicationQuit()
 {
     EventKit.Broadcast("set screen size", savedUnitsOnScreen);
 }
 void OnEnable()
 {
     EventKit.Subscribe <Hit>("player dead", OnPlayerDead);
 }
Exemplo n.º 28
0
    void OnDisable()
    {
        EventKit.Broadcast("reposition hud elements");

        UnityEditorInternal.InternalEditorUtility.RepaintAllViews();
    }
Exemplo n.º 29
0
    void Explode(Hit hit)
    {
        gameObject.SetActive(true);

        //randomly choose an disintegration type
        switch (Rand.Range(1, 1))
        {
        case 0:
            disintegration = Type.Explosion;
            break;

        case 1:
            disintegration = Type.Directional_Explosion;
            break;

        case 2:
            disintegration = Type.Slump;
            break;

        case 3:
            disintegration = Type.Directional_Slump;
            break;

        case 4:
            disintegration = Type.Geyser;
            break;

        default:
            Assert.IsTrue(false, "** Default Case Reached **");
            break;
        }

        //cycle through pieces and send them flying
        foreach (Transform child in transform)
        {
            int direction;

            //activate physics on this piece
            Rigidbody2D childRigidbody2D = child.GetComponent <Rigidbody2D>();
            childRigidbody2D.isKinematic = false;

            //start countdown towards this piece fading out
            BreakablePiece piece = child.GetComponent <BreakablePiece>();
            piece.CountDown();

            //apply disintegrations!
            switch (disintegration)
            {
            case Type.Explosion:
                childRigidbody2D.AddExplosionForce(2000, transform.position, 20);
                break;

            case Type.Directional_Explosion:
                int force = (hit.horizontalSide == Side.Right) ? -50 : 50;
                childRigidbody2D.AddForce(new Vector3(force, 50, 50), ForceMode2D.Impulse);
                // params = duration, strength, vibrato, randomness.
                EventKit.Broadcast("shake camera", .7f, .4f, 20, 3f);
                break;

            case Type.Slump:
                childRigidbody2D.AddExplosionForce(250, transform.position, 3);
                break;

            case Type.Directional_Slump:
                direction = (hit.horizontalSide == Side.Right) ? 1 : -1;
                childRigidbody2D.AddForce(new Vector3(0, -100, 0));
                childRigidbody2D.AddExplosionForce(800, new Vector3(
                                                       transform.position.x + direction,
                                                       transform.position.y + .5f,
                                                       transform.position.z), 2
                                                   );
                break;

            case Type.Geyser:
                childRigidbody2D.AddForce(new Vector3(0, -75, 0), ForceMode2D.Impulse);
                break;

            default:
                Assert.IsTrue(false, "** Default Case Reached **");
                break;
            }
        }
    }
Exemplo n.º 30
0
 override public void OnBodyCollisionStay()
 {
     EventKit.Broadcast("player touching wall", true);
 }