void CheckHealth() { if (AmountHealth <= 0 && !isDead) { CharacterReferences CR = CharacterReferences.instance; isDead = true; gameObject.tag = "Untagged"; CR.playerInfo.totalDeaths++; CR.playerInfo.totalMetersRunned += EnvironmentController.instance.UIC.currentMeters; CR.uic.metersRun = CR.uic.currentMeters; if (CR.playerInfo.metersRecord < CR.uic.metersRun) { CR.playerInfo.metersRecord = CR.uic.metersRun; if (PlayGamesPlatform.Instance.IsAuthenticated()) { MainMenuAnimator.instance.GPL.LeaderboardUpdate(CR.uic.metersRun); } } //EnvironmentController.instance.gameOverDelegate(); //gameObject.SetActive(false);//Better to deactivate because of errors and its easy to only move and activate and not Instantiating another //gameObject.SetActive(false);//Better to deactivate because of errors and its easy to only move and activate and not Instantiating another MainMenuAnimator.instance.ToggleRewardedVideoButton(); if (reallyDead == true) { AC.DeathAnim(); } } }
public void CreatePatch(Patch patch, IList <ValuePair <Model> > npcs) { var modifiedNpcs = npcs.Where(x => x.Modified).ToList(); if (!modifiedNpcs.Any()) { return; } var npcMap = new CharacterReferences() .LoadMap(modifiedNpcs.Select(x => x.Default)); var modifications = new List <(ValuePair <Model> Npc, string File)>(); foreach (var npc in modifiedNpcs) { if (!npcMap.TryGetValue(npc.Default, out var files)) { continue; } foreach (var file in files) { modifications.Add((npc, file)); } } foreach (var mods in modifications.GroupBy(x => x.File)) { UpdateCharacterReference(patch, mods.Key, mods.Select(x => x.Npc)); } var mapping = modifiedNpcs.Select(x => (x.Default.Id, x.Value.Id)); patch.AddObject(mapping, MapName); }
private void Awake() { rf = GetComponent <CharacterReferences>(); rb = GetComponent <Rigidbody>(); animator = transform.GetChild(0).GetComponent <Animator>(); //Deactivate ParticleSystems rf.anim_partSystemShot.Stop(); rf.anim_partSystemCarry.Stop(); }
private void Awake() { if (instance != null) { Destroy(gameObject); } else { instance = this; } }
public void Resucitate() { //DETECT POSITION RaycastHit2D hit2d = new RaycastHit2D(); bool hit = false; ContactFilter2D filter = new ContactFilter2D(); filter.layerMask = resucitateMask; filter.useLayerMask = true; RaycastHit2D[] results = new RaycastHit2D[10]; int resultsint = Physics2D.CircleCast(transform.position, resucitateRadius, Vector3.zero, new ContactFilter2D(), results); int length = results.Length; for (int i = 0; i < length; i++) { if (results[i].collider.gameObject.CompareTag("Floor")) { hit = true; hit2d = results[i]; break; } } if (hit) { BoxCollider2D box = hit2d.transform.GetComponent <BoxCollider2D>(); Vector3 tempTransform = new Vector3(); tempTransform.x = hit2d.transform.position.x + box.offset.x; tempTransform.y = hit2d.transform.position.y + box.offset.y; tempTransform.z = transform.position.z; transform.position = tempTransform; Debug.Log(tempTransform); } CharacterReferences CR = CharacterReferences.instance; CR.TM.dead = false; CR.FF.FollowFunc(); isDead = false; Debug.Log(gameObject.tag); gameObject.tag = "Player"; reallyDead = false; AmountHealth = maxHealth; healthScript.UpdateHearts(AmountHealth); CR.TM.jumps = 2; //transform.position = new Vector3(transform.position.x, 13f, transform.position.z); CR.TM.rb.velocity = Vector3.zero; canDie = false; StartCoroutine("CanDieAfterResucitate"); }
public void GetEnvironments() { CharacterReferences CR = CharacterReferences.instance; sets = Resources.LoadAll <EnvironmentSet>("Sets"); //Take scriptables EnvironmentSet from Resources on runtime int length = sets.Length; for (int i = 0; i < length; i++) { switch (sets[i].setType) { case SetType.Forest: if (CR.charactersInfo.characters[0].unlocked) { setsList.Add(sets[i]); } break; case SetType.Desert: if (CR.charactersInfo.characters[1].unlocked) { setsList.Add(sets[i]); } break; case SetType.Ice: if (CR.charactersInfo.characters[3].unlocked) { setsList.Add(sets[i]); } break; case SetType.Lava: if (CR.charactersInfo.characters[2].unlocked) { setsList.Add(sets[i]); } break; case SetType.Candy: if (CR.charactersInfo.characters[4].unlocked) { setsList.Add(sets[i]); } break; } } }
public void Special() { CR.TM.isSpecial = true; StartCoroutine("AnimTo0"); if (CR == null) { CR = CharacterReferences.instance; //rotationTarget = CR.AC.anim.transform; } CR.AC.SpecialAttack(); //Set Anim sc.PlaySound(2); isRotating = true; CR.PS.canDie = false; CR.AC.isAnimatingSpine = false; StartCoroutine("EndSpecialCO"); }
public void Special() { StartCoroutine("Countdown"); StartCoroutine("CanFire"); if (CR == null) { CR = CharacterReferences.instance; } bulletFiredCount = 0; int length = ballParents.Length; for (int i = 0; i < length; i++) { PBS[i] = Instantiate(customBullet, ballParents[i]).GetComponent <PlayerBulletScript>(); } specialHolder.gameObject.SetActive(true); sc.PlaySound(2); Debug.Log("Instantiated Bullets"); }
//FinishTimeControl public void UpdateEnvironments() { CharacterReferences CR = CharacterReferences.instance; int length = sets.Length; for (int i = 0; i < length; i++) { switch (sets[i].setType) { case SetType.Forest: if (CR.charactersInfo.characters[0].unlocked) { setsList.Add(sets[i]); } break; case SetType.Desert: if (CR.charactersInfo.characters[1].unlocked) { setsList.Add(sets[i]); } break; case SetType.Ice: if (CR.charactersInfo.characters[3].unlocked) { setsList.Add(sets[i]); } break; case SetType.Candy: if (CR.charactersInfo.characters[4].unlocked) { setsList.Add(sets[i]); } break; } } }
private void Start() { CR = CharacterReferences.instance; }
private void Start() { EC = EnvironmentController.instance; CR = CharacterReferences.instance; }
public void Special() { CR = CharacterReferences.instance; StartCoroutine("SpecialCO"); }