void OnDisable() { EventKit.Unsubscribe <bool>("level completed", OnLevelCompleted); EventKit.Unsubscribe <int, Weapon.WeaponType>("player dead", OnPlayerDead); }
void OnDestroy() { EventKit.Unsubscribe <bool>("save game data", OnSaveGameData); EventKit.Unsubscribe <bool>("load game data", OnLoadGameData); }
void OnDestroy() { EventKit.Unsubscribe <Hit>("player dead", OnPlayerDead); }
void OnEnable() { EventKit.Subscribe <int>("init score", OnInitScore); EventKit.Subscribe <int>("change score", OnChangeScore); EventKit.Subscribe <bool>("fade hud", OnFadeHud); }
//Clean up eventTable every time a new level loads. public void SceneLoaded(int unused) { EventKit.Cleanup(); }
void Awake() { _attackDisabled = disableAttack; EventKit.Broadcast("wake singletons"); }
void OnPrizeCollected(int worth) { gameData.CurrentScore += worth; EventKit.Broadcast <int>("change score", gameData.CurrentScore); }
void OnEnable() { EventKit.Subscribe <int>("init lvl", OnInitInteger); EventKit.Subscribe <bool>("fade hud", OnFadeHud); }
void OnDestroy() { EventKit.Unsubscribe <int>("init lvl", OnInitInteger); EventKit.Unsubscribe <bool>("fade hud", OnFadeHud); }
void OnDestroy() { EventKit.Unsubscribe <int, Weapon.WeaponType>("player dead", OnPlayerDead); }
void OnDestroy() { EventKit.Unsubscribe <GameObject, Side>("init stashed weapon", OnInitStashedWeapon); EventKit.Unsubscribe <GameObject, Side>("change stashed weapon", OnChangeStashedWeapon); EventKit.Unsubscribe("reposition hud elements", SetTweens); }
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); }
void OnEnable() { EventKit.Subscribe <int>("init hp", OnInitHP); EventKit.Subscribe <int>("reduce hp", OnReduceHP); EventKit.Subscribe <bool>("fade hud", OnFadeHud); }
void OnEnable() { EventKit.Subscribe <bool>("player above ground", OnPlayerAboveGround); }
void OnDestroy() { EventKit.Unsubscribe <int>("init hp", OnInitHP); EventKit.Unsubscribe <int>("reduce hp", OnReduceHP); EventKit.Unsubscribe <bool>("fade hud", OnFadeHud); }
void OnDisable() { EventKit.Unsubscribe <bool>("player above ground", OnPlayerAboveGround); }
void Start() { gameData = GameObject.Find(_DATA).GetComponent <GameData>(); EventKit.Broadcast <int>("init score", gameData.CurrentScore); }
void OnDisable() { EventKit.Unsubscribe <bool>("level completed", OnLevelCompleted); EventKit.Unsubscribe <Hit>("player dead", OnPlayerDead); }
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); }
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); }
void OnEnable() { EventKit.Subscribe <bool>("save game data", OnSaveGameData); EventKit.Subscribe <bool>("load game data", OnLoadGameData); }
void OnApplicationQuit() { EventKit.Broadcast("set screen size", savedUnitsOnScreen); }
void OnEnable() { EventKit.Subscribe <Hit>("player dead", OnPlayerDead); }
void OnDisable() { EventKit.Broadcast("reposition hud elements"); UnityEditorInternal.InternalEditorUtility.RepaintAllViews(); }
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; } } }
override public void OnBodyCollisionStay() { EventKit.Broadcast("player touching wall", true); }