void AttackSwitch() { float rand = Random.Range(0f, 1f); if (distanceP < 6.5f) { if (rand < 0.4f) { state = BossMode.TriggerSnipe; } else { state = BossMode.WalkToPlayer; } } else { if (rand < 0.3f) { state = BossMode.WalkToPlayer; } else if (rand < 0.43f) { state = BossMode.TriggerSnipe; } else { state = BossMode.Jump; } } }
private void OnEnable() { bossMode = (BossMode)target; bossFunctions = new List <string>(); bossFunctions = typeof(BossBehaviour) .GetMethods(BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public) // Instance methods, both public and private/protected .Where(x => x.DeclaringType == typeof(BossBehaviour)) // Only list methods defined in our own class .Where(x => x.GetParameters().Length == 0) // Make sure we only get methods with zero argumenrts .Select(x => x.Name) .ToArray().ToList(); }
void WalkToPlayer() { if (distanceP > stopRange) { counter = timer; anim.SetTrigger("Walk"); state = BossMode.ReachToPlayer; } else { state = BossMode.Attack0; } }
void ReachToPlayer() { if (distanceP <= stopRange) { anim.SetTrigger("SWalk"); state = BossMode.Attack0; } else if (counter + 3.5 < timer) { anim.SetTrigger("SWalk"); FacePlayer(); state = BossMode.Jump; } }
protected override void Death() { if (this.isDying) { return; } this.mode = BossMode.Death; HUDManager.instance.DisplayBossHealthBar(false); this.behaviour.Cancel(this); AudioManager.instance.PlaySound("BossDeath"); StartCoroutine(this.DeathCoroutine()); }
void Start() { rig = GetComponent <Rigidbody2D>(); anim = GetComponent <Animator>(); //Physics2D.IgnoreCollision(player.GetComponent<Collider2D>(), GetComponent<Collider2D>()); player_ = PlayerManager.instance.player; player_T = PlayerManager.instance.player_transform; state = BossMode.CalWaiting; counter = 0; timer = 0; snipeable = false; eManager = GetComponent <EnemyManager>(); originHp = eManager.GetHp(); AttackParticleActive(true); }
public World(int number, bool multiMap, string worldSprite, bool shuffle, bool removePlayer, bool lockTravel, Area[] areas, string[] bosses, BossMode bossMode, bool showEyes, SemibossMode semibossMode, string[][] semibosses) { this.number = number; this.multiMap = multiMap; this.worldSprite = worldSprite; this.shuffle = shuffle; this.removePlayer = removePlayer; this.lockTravel = lockTravel; this.areas = areas; this.bosses = bosses; this.bossMode = bossMode; this.showEyes = showEyes; this.semibossMode = semibossMode; this.semibosses = semibosses; }
public void ChangeMode(BossMode _newMode) { timeSinceLastModeChange = 0; if (currentMode != null) { foreach (string s in currentMode.actionsOnEnd) { InvokeMethod(s); } } currentMode = _newMode; foreach (string s in currentMode.actionsOnStart) { InvokeMethod(s); } navMesh.speed = bossDatas.globalSettings.moveSpeed * _newMode.movementSpeedMultiplier; navMesh.angularSpeed = bossDatas.globalSettings.angularSpeed * _newMode.rotationSpeedMultiplier; }
public void SnipeEnd() { state = BossMode.Idle; rig.velocity = Vector2.zero; }
void BossAI() { distanceP = CheckDistance(transform.position, player.transform.position); switch (state) { case BossMode.Idle: if (anim.GetCurrentAnimatorStateInfo(0).IsName("idle")) { timer = 0; state = BossMode.CalWaiting; counter = 0; AttackParticleActive(false); } break; case BossMode.CalWaiting: float bossWaitingTime_ = bossWaitingTime; float hpEff = GetComponent <EnemyManager>().GetHp() / originHp; AttackParticleActive(false); if (hpEff <= 0.3) { bossWaitingTime_ = 1; } else if (hpEff <= 0.5) { bossWaitingTime = 2; } if (timer > bossWaitingTime_) { state = BossMode.FacePlayer; } break; case BossMode.FacePlayer: FacePlayer(); state = BossMode.AttackSwitch; AttackParticleActive(false); break; case BossMode.AttackSwitch: AttackSwitch(); AttackParticleActive(false); break; case BossMode.WalkToPlayer: WalkToPlayer(); AttackParticleActive(false); break; case BossMode.ReachToPlayer: ReachToPlayer(); AttackParticleActive(false); break; case BossMode.Attack0: anim.SetTrigger("attack0"); state = BossMode.Idle; AttackParticleActive(true); break; case BossMode.Jump: anim.SetTrigger("Jump"); state = BossMode.JumpAttack; AttackParticleActive(false); break; case BossMode.JumpAttack: if (anim.GetCurrentAnimatorStateInfo(0).IsName("jump_mid") && Physics2D.Raycast(transform.position, new Vector3(0, 1, 0), 0.1f) && rig.velocity.y < 0.01f) { anim.SetTrigger("SJump"); CameraShake_(0.4f); JumpAttack(); AttackParticleActive(false); state = BossMode.Idle; } break; case BossMode.TriggerSnipe: anim.SetTrigger("Snipe"); state = BossMode.Snipe; AttackParticleActive(true); snipeable = false; break; case BossMode.Snipe: if (snipeable == true) { Attack0(); AttackParticleActive(true); Instantiate(slashEffect, (transform.position), transform.rotation); } break; default: break; } }
public void SwitchMode() { int old = (int)this.mode; this.mode = (BossMode)((old + Random.Range(1, 4)) % 4); }