void Start() { Cursor.visible = false; if (instance == null) { instance = this; // Protection to make sure there is only one instance of GameManager } else if (instance != this) { Destroy(this); } monster = Monster.instance; player = Player.instance; moveDirection = L1PushMonsterCheck; // Make function the level 1 version barrierDirection = L1BarrierCheck; worldInteraction = L1PuzzleInteraction; currentWorld = level1; // Start at level 1 ResetToWorld(currentWorld); worldCompleted = level0.GetComponent <World>().PuzzleSolvedEvents; transform.position = monsterView; // Start us at right view #if DEBUG ShortCut(); #endif }
/// <summary> /// Checks whether the given world event has been triggered. /// </summary> public bool CheckWorldEvent(WorldEvents worldEvent) { int offset = 0; switch (worldEvent) { case WorldEvents.Friend: offset = MemoryOffsets.AssembledFriend; break; case WorldEvents.Escape: offset = MemoryOffsets.Escaping; break; case WorldEvents.End1: offset = MemoryOffsets.BeatEnd1; break; case WorldEvents.End2: offset = MemoryOffsets.BeatEnd2; break; } return(process.Read <bool>(dataPointer, offset)); }
void LevelUp() { player.Interact = false; // Stops player moving worldDoor.GetComponent <WorldDoor>().ChangeSprite(1); // Change to open door. currentWorld.GetComponentInChildren <Collider2D>().enabled = false; // Remove door blocker foreach (World world in FindObjectsOfType <World>()) { world.Rotation *= -1; // Rotate other way } if (currentWorld == level1) { level0.GetComponentInChildren <World>().LevelComplete = true; worldDoor.GetComponent <WorldDoor>().ChangeSpriteOrder("Back Object"); // Change to behind Monster. worldDoor.transform.GetChild(0).gameObject.SetActive(false); // Mask moveDirection = L2PullMonsterCheck; barrierDirection = L2BarrierCheck; worldInteraction = L2PuzzleInteraction; monster.Evolve(1); player.movement = player.Evolve; player.attachCollarHere = monster.transform.Find("Collar").transform; currentWorld = level2; } else if (currentWorld == level2) { level1.GetComponentInChildren <World>().LevelComplete = true; currentWorld = level3; } ResetToWorld(currentWorld); }
public void TriggerEvent(WorldEvents eventDesignation) { this.eventBuffer = null; if (this.EventDatabase.TryGetValue(eventDesignation, out this.eventBuffer)) { this.eventBuffer.Invoke(); } }
public void UnSubscribeEvent(WorldEvents eventDesignation, UnityAction listener) { if (!Instance) { return; } this.eventBuffer = null; if (this.EventDatabase.TryGetValue(eventDesignation, out this.eventBuffer)) { this.eventBuffer.RemoveListener(listener); } }
public void Disconnect(string title, string reason) { Events.RaiseDisconnected(title, reason); Gui.Reset(this); World.Reset(); WorldEvents.RaiseOnNewMap(); IDrawer2D.InitCols(); BlockInfo.Reset(); TexturePack.ExtractDefault(this); Gui.SetNewScreen(new DisconnectScreen(this, title, reason)); GC.Collect(); }
public void SubscribeEvent(WorldEvents eventDesignation, UnityAction listener) { this.eventBuffer = null; if (this.EventDatabase.TryGetValue(eventDesignation, out eventBuffer)) { this.eventBuffer.AddListener(listener); } else { this.eventBuffer = new UnityEvent(); this.eventBuffer.AddListener(listener); this.EventDatabase.Add(eventDesignation, this.eventBuffer); } }
public void Disconnect(string title, string reason) { World.Reset(); WorldEvents.RaiseOnNewMap(); Gui.SetNewScreen(new DisconnectScreen(this, title, reason)); IDrawer2D.InitCols(); BlockInfo.Reset(); TexturePack.ExtractDefault(this); for (int i = 0; i < Components.Count; i++) { Components[i].Reset(this); } GC.Collect(); }
internal WorldEventBL(WorldEvents WorldEvent, Extension ext) { worldEvent = WorldEvent; this.ext = ext; }
internal WorldEventBL(WorldEvents WorldEvent) { worldEvent = WorldEvent; }
// Update is called once per frame void Update() { OncePerFrame = true; // check if dead if (hp <= 0) { dead(); } if (IsDamageable) { immunity_timer += Time.deltaTime; if (immunity_timer > immunity) { } } // Get inputs MoveX = Input.GetAxisRaw("Horizontal"); MoveY = Input.GetAxisRaw("Vertical"); Button_Space |= Input.GetButtonDown("Jump"); Button_Ctrl |= Input.GetButtonDown("Fire1"); Button_Attack |= Input.GetButtonDown("Fire2"); Button_Tongue |= Input.GetButtonDown("Fire3"); // Animation states if (IsControllable) { // Compute facing direction for diagonals ComputeFacingDirection(); if (MoveX != 0 && MoveX < 0) { SR.flipX = true; } else if (MoveX != 0) { SR.flipX = false; } Animator.SetInteger("Facingdirection", Player_Facing_Direction); Animator.SetBool("IsIdle", false);//(MoveX == 0 && MoveY==0)); // SetInt(Form) too here? } BC.enabled = true; // > Check for player upgrade updates // Space => Make the player pop if (Button_Space && !acquired_existence && !!worldGO) { WorldEvents worldEvents = worldGO.GetComponent <WorldEvents>(); worldEvents.player_acquired(); acquired_existence = true; DialogController dc = UIGO.GetComponent <DialogController>(); if (!!dc) { dc.startExitenceLine(); } } // Ctrl => Make the Player controllable if (Button_Ctrl && acquired_existence) { DialogController dc = UIGO.GetComponent <DialogController>(); if (!!dc) { dc.startControlLine(); } } if (IsAttacking || IsTranslating) { // Draw tongue between Player position and TonguePosition Vector3[] positions = new Vector3[2]; positions[0] = transform.position; positions[1] = TongueTip.transform.position; LR.SetPositions(positions); } else { LR.enabled = false; } // Attack timer if (IsAttacking) { AttackCounter += Time.deltaTime; // If Attack is ending if (AttackCounter > AttackTime) { ResetAttack(); } if (AttackCounter > AttackTime / 2F) { ReturnTongue(); } } if (IsTranslating) { // Make the Tongue Tip move according the the Player local space // Be careful not to start a new TongueHit. // var HitPoint_Local = transform.InverseTransformPoint(new Vector3(TongueHitPosition.x, TongueHitPosition.y, 0)); // TongueTip.transform.localPosition = HitPoint_Local; TongueTip.transform.position = TongueHitPosition; } if (acquired_tongue && !IsAttacking && !IsTranslating && !IsRealAttack && Button_Tongue) { // Test attack StartAttack(); } if (acquired_attack && !IsAttacking && !IsTranslating && !IsRealAttack && Button_Attack) { LaunchAttack(); } }//! Update