public void randomEnemySpawn() { int randX, randY, randEnemy; GameObject enemy; do { randX = Random.Range(3, tileMap.GetLength(1) - 3); randY = Random.Range(3, tileMap.GetLength(0) - 3); do // assuming bomb is in slot 1. Dirty quick fix. Limits number of bomb spawn count to 10. Else chain reaction and game crashes. { randEnemy = Random.Range(0, enemies.Length); } while (randEnemy == 1 && bombsSpawned > maxBombsPerWave); } while (!(tileMap[randY, randX] == 0 && tileMap[randY + 1, randX] == 1)); if (randEnemy == 1) { bombsSpawned++; } enemy = enemies[randEnemy]; float xTilePosition = (randX * width + mapTranslation.x); float yTilePosition = (((tileMap.GetLength(0) - randY) * height) + mapTranslation.y); if (enemy.transform.name.Equals("Golem")) { Instantiate(enemy, GolemAI.getSpawnLocation(randY, randX, tileMap.GetLength(0)), Quaternion.identity); } else { Instantiate(enemy, new Vector3(xTilePosition, yTilePosition, 0), Quaternion.identity); } enemyCount++; }
public void randomEnemySpawn() { int randX, randY, randEnemy; GameObject enemy; do { randX = Random.Range(3, tileMap.GetLength(1) - 3); randY = Random.Range(3, tileMap.GetLength(0) - 3); randEnemy = Random.Range(0, enemies.Length); } while (!(tileMap[randY, randX] == 0 && tileMap[randY + 1, randX] == 1)); enemy = enemies [randEnemy]; float xTilePosition = (randX * width + mapTranslation.x); float yTilePosition = (((tileMap.GetLength(0) - randY) * height) + mapTranslation.y); if (enemy.transform.name.Equals("Golem")) { Instantiate(enemy, GolemAI.getSpawnLocation(randY, randX, tileMap.GetLength(0)), Quaternion.identity); } else { Instantiate(enemy, new Vector3(xTilePosition, yTilePosition, 0), Quaternion.identity); } enemyCount++; }
public BerserkNode(AI reference, GroundSpikesNode groundSpike, GroundSlamNode groundSlam, RockThrowNode rockThrow, float beserkHealthPercent) : base(reference) { m_SpikeNode = groundSpike; m_SlamNode = groundSlam; m_RockThrowNode = rockThrow; m_BeserkPercentage = beserkHealthPercent; m_GolemAI = m_AIReference as GolemAI; }
public PunchNode(AI reference, float knockback, int damage, float attackRange, BoxCollider punchHitBox, FistCollider fist) : base(reference) { //Set up the values m_Knockback = knockback; m_Damage = damage; m_PunchHitBox = punchHitBox; m_AttackRange = attackRange; m_Fist = fist; m_Fist.Damage = damage; m_Fist.ElementalDamage = m_AIReference.ElementalDamage.ToArray(); m_GolemAI = m_AIReference as GolemAI; }
// OnStateEnter is called when a transition starts and the state machine starts to evaluate this state override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { ai = animator.gameObject.GetComponent <GolemAI>(); ai.beginTeleportingOut(); }
// OnStateEnter is called when a transition starts and the state machine starts to evaluate this state //override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { // //} // OnStateUpdate is called on each Update frame between OnStateEnter and OnStateExit callbacks //override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { // //} // OnStateExit is called when a transition ends and the state machine finishes evaluating this state override public void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { ai = animator.gameObject.GetComponent <GolemAI>(); ai.destroyObject(); }