private IEnumerator GrabProjectiles(PlayerController owner) { Collider[] enemyProjectiles = Physics.OverlapSphere(owner.transform.position, m_radius, m_grabMask, QueryTriggerInteraction.Collide); //Do some sort of visual here if (enemyProjectiles.Length == 0) { //If anyprojectiles are near but not caught, minus the grab skill enemyProjectiles = Physics.OverlapSphere(owner.transform.position, m_missRadius, m_grabMask, QueryTriggerInteraction.Collide); if (enemyProjectiles.Length != 0) { CurveFlowManager.AppendValue("GrabSkill", 0.0f); } //Spell has not gotten a projectile, don't lock casting and just let the whiff animation play yield return(null); } else { //Spell has gotten at least one projectile, grab them and enter into the special mode for it owner.m_abilityManager.m_isCasting = true; float DRAWTIME = 0.6f; //Disable their projectileMovement scripts and then pull all them in all fancy like for (int j = 0; j < enemyProjectiles.Length; j++) { ProjectileMovement proj = enemyProjectiles[j].GetComponent <ProjectileMovement>(); owner.StartCoroutine(DrawInProjectile(owner, proj, DRAWTIME)); CurveFlowManager.AppendValue("GrabSkill", 1.0f); } yield return(new WaitForSeconds(DRAWTIME)); owner.m_abilityManager.SetGrab(enemyProjectiles.Length); owner.m_abilityManager.m_isCasting = false; } }
private void Start() { m_healthImage = GameObject.Find("HealthImage").GetComponent <Image>(); m_healthText = m_healthImage.transform.GetChild(1).GetComponent <TMPro.TMP_Text>(); m_healthText.text = m_currentHealth.ToString(); CurveFlowManager.SetValue("CurrentHealth", (float)m_currentHealth / m_maxHealth); }
public void SetupBossFight() { for (int j = 0; j < surface.transform.childCount; j++) { surface.transform.GetChild(j).gameObject.SetActive(false); } PlayerController.player.transform.position = Vector3.zero; CurveFlowManager.LoadQuery(DungeonName + "Bosses"); TileData tile = Instantiate(Resources.Load("TileSets/" + DungeonName + '/' + CurveFlowManager.Query(0.0f)) as TileData); Instantiate(tile.m_prefab, Vector3.zero, Quaternion.identity).transform.GetChild(1).GetChild(0).GetComponent <Enemy>().PlayerEnterRoom(PlayerController.player.transform); surface.BuildNavMesh(); //Boss is already spawned, enemies in the tile are actual spawnpoints to be used by group selection CurveFlowManager.LoadQuery(DungeonName + "BossMinions"); string[] minions = CurveFlowManager.GroupQuery(0.0f, tile.m_enemies.Length); for (int j = 0; j < minions.Length; j++) { Debug.Log(j + ": " + minions[j]); Enemy enem = Instantiate(Resources.Load("Enemies/" + minions[j]) as GameObject, tile.m_enemies[j].SpawnPosition, Quaternion.identity).GetComponent <Enemy>(); enem.PlayerEnterRoom(PlayerController.player.transform); } }
private void OnTriggerEnter(Collider other) { if (m_isDead) { return; } //enemy projectile if (other.gameObject.layer == 12) { if (!m_invincible) { ProjectileMovement proj = other.gameObject.GetComponent <ProjectileMovement>(); if (proj != null && proj.gameObject.layer == 12) { TakeDamage(proj.m_damage); proj.gameObject.SetActive(false); //If they got hit by a projectile and could have grabbed it if (m_abilityManager.IsGrabAvalible()) { CurveFlowManager.AppendValue("GrabSkill", 0.0f); } } else { Debug.Log("Hit by unkown object: " + other.gameObject.name); } } } //room trigger else if (other.gameObject.layer == 16) { other.gameObject.SetActive(false); WorldController.i.StartCombat(other.transform.parent); } }
private void OnApplicationQuit() { CurveFlowManager.SaveProfile(); if (CurveFlowManager.m_writeDebugFile) { CurveFlowManager.WriteValuesOverTime(); } }
public void EnemyWhiffAttack() { //if currently invincble or if the dodge is on cooldown (in this case, assumed player already dodged) if (m_invincible || !m_abilityManager.IsDodgeAvalible()) { CurveFlowManager.AppendValue("DodgeSkill", 1.0f); } }
void RecurseMap(int recurseCount, Coordinate current, Vector3Int direction) { if (m_currentMap.ContainsKey(current)) { return; } TileData tile = Instantiate(Resources.Load("TileSets/" + DungeonName + '/' + CurveFlowManager.QueryOnCurve(0.25f, Random.Range(0.0f, 2.0f))) as TileData); m_currentMap.Add(current, tile); Quaternion rot = Quaternion.identity; //Select a random valid direction to be the new doorway Vector3Int oldDoor = tile.m_doorways[Random.Range(0, tile.m_doorways.Length)]; //Get the new rotation of the tile float angle = Vector3.SignedAngle(oldDoor, direction * -1, Vector3.up); rot = Quaternion.AngleAxis(angle, Vector3.up); //Also change the m_doorways for (int j = 0; j < tile.m_doorways.Length; j++) { Vector3 floatVec = tile.m_doorways[j]; floatVec = rot * floatVec; tile.m_doorways[j] = Vector3Int.RoundToInt(floatVec); } GameObject inst = Instantiate(tile.m_prefab, Vector3.one * current, rot, surface.transform); tile.m_instancedPrefab = inst; tile.m_exitDoors = inst.transform.GetChild(2); Transform enemyHolder = inst.transform.GetChild(1); //Enemy Spawning for (int j = 0; j < tile.m_enemies.Length; j++) { Instantiate(tile.m_enemies[j].EnemyPrefab, inst.transform.TransformPoint(tile.m_enemies[j].SpawnPosition), Quaternion.identity, enemyHolder); } //Debug Text display Vector3 canvasPos = CANVASSTARTPOS; //m_worldCanvas.transform.TransformPoint(CANVASSTARTPOS); canvasPos.x += current.x * CANVASCOORDOFFSET; canvasPos.y += current.y * CANVASCOORDOFFSET; canvasPos.y += 40f; GameObject worldText = Instantiate(m_worldTextObject, Vector3.up * 3, m_worldCanvas.transform.rotation, m_worldCanvas.transform); worldText.GetComponent <RectTransform>().anchoredPosition = canvasPos; worldText.transform.GetChild(0).GetComponent <TMPro.TMP_Text>().text = CurveFlowManager.LastMessage; if (recurseCount == 0) { //Close the doorways (how do i find out which ones to close aa } else { foreach (Vector3Int dir in tile.m_doorways) { RecurseMap(recurseCount - 1, current + dir, dir); } } }
void Awake() { i = this; CurveFlowManager.Initialize(DungeonName + "Tiles"); CurveFlowManager.SetGUIValues(GameObject.Find("TrackedValuesPanel").transform); System.Diagnostics.Stopwatch buildTimer = System.Diagnostics.Stopwatch.StartNew(); BuildMap(RecurseCount, new Coordinate()); m_remainingRooms = m_currentMap.Keys.Count - 1; surface.BuildNavMesh(); buildTimer.Stop(); Debug.Log("Generated " + surface.transform.childCount + " tiles in " + buildTimer.ElapsedMilliseconds); }
private void TakeDamage(int damage) { if (m_isDead) { return; } m_currentHealth -= damage; if (m_currentHealth <= 0) { Die(); } m_healthText.text = m_currentHealth.ToString(); m_healthImage.fillAmount = (float)m_currentHealth / m_maxHealth; CurveFlowManager.SetValue("CurrentHealth", (float)m_currentHealth / m_maxHealth); }
public void TakeMeleeAttack(int damage) { if (m_invincible) { //DodgeSkill also includes other skills that make you invincible (if they exist) CurveFlowManager.AppendValue("DodgeSkill", 1.0f); } else { TakeDamage(damage); if (m_abilityManager.IsDodgeAvalible()) { CurveFlowManager.AppendValue("DodgeSkill", 0.0f); } } }