/// <summary> /// This should be in an update function, and run every frame. Will check if it hits the ground, and then do next jump. /// </summary> /// <param name="bossRigidbody"></param> public void TwompingSequence(Rigidbody bossRigidbody, ParticleSystem JumpAttackLanding) { if (StartTwompingSequence) { if (usingGravity) { bossRigidbody.velocity += Vector3.up * gravity * Time.deltaTime; } Vector3 direction = Vector3.ProjectOnPlane((endGoal - transform.position), Vector3.up); direction = direction.normalized * leapSize; print(direction + " direction"); if (mAction == currentAction.standing) { print("inside standing"); if (currentJump <= amountOfJumps) { if (!usingGravity) { usingGravity = true; } StartCoroutine(delayCheckForGround()); mAction = currentAction.jumping; mAnimations.Animation_shortJump(); currentJump++; bossRigidbody.isKinematic = false; bossRigidbody.velocity = CalculateJump(transform.position + direction); print("CurrentJump: " + currentJump + " OF " + amountOfJumps); } } else if (mAction == currentAction.jumping && !delayingCheck) { RaycastHit groundHit; if (Physics.Raycast(transform.position + (Vector3.up * 0.05f), Vector3.down, out groundHit, 0.5f)) { if (groundHit.collider != null) { mAction = currentAction.standing; usingGravity = false; JumpAttackLanding.Stop(); JumpAttackLanding.Play(); print(CheckIfPlayerGotHit() + " - got hit"); if (currentJump >= amountOfJumps) { mAnimations.Animation_StopTwomping(); StartTwompingSequence = false; GetComponent <EnemySnowman>().SetSnowManState(EnemySnowman.States.Reatreating); print("Sequence ended!"); } } } } } else { bossRigidbody.velocity = Vector3.zero; } }
public void HitCheck() { if (attacked) { currentaction = Recoil; } }
void Attack() { UpdateStartPos(); Attack clone = Instantiate(attack, hitboxspawn.transform.position, hitboxspawn.transform.rotation); currentaction = Idle; }
void Start() { UpdateStartPos(); rightpos.z = startpos.z; leftpos.z = rightpos.z; currentaction = Idle; localScale = transform.localScale; }
public void Spin() { location.currentTarget = back; if (location.IsCloseToTarget()) { currentaction = Spin2; } }
void FixedUpdate() { if (Input.GetKeyDown(KeyCode.H) && testdamage) { Damage(true); } if (!spinning) { gameObject.transform.position = location.transform.position; } if (FB) { anim.SetBool("FBAnim", true); fre -= Time.fixedDeltaTime; if (fre <= 0) { EnemyProjectile clone; clone = Instantiate(fire, Mouth.transform.position, Mouth.transform.rotation); fre = firefrequency; source.UnPause(); ffp = true; } } else { if (ffp) { anim.SetBool("FBAnim", false); source.Pause(); ffp = false; } } if (Health <= (StartingHealth / 3) && !phase2) { SecondPhase(); } if (Health <= 0) { currentaction = Die; } if (flashed) { currentflashtime -= Time.fixedDeltaTime; if (currentflashtime <= 0) { flashed = false; slide.color = norm; currentflashtime = flashtime; } } transform.localScale = localScale; currentaction(); }
public void Begin() { slider.value += 20f * Time.fixedDeltaTime; location.currentTarget = startpoint; source.Pause(); if (location.IsCloseToTarget()) { currentaction = Idle; } }
void Chase() { Moving(); if (Vector3.Distance(gameObject.transform.position, Player.transform.position) < AttackDistance) { currentaction = Attack; } if (vision.sighted == false) { currentaction = Idle; UpdateStartPos(); } }
public override void Damage(bool KB) { base.Damage(KB); attacked = false; flashed = true; slide.color = flash; if (Health <= 0) { currentaction = Die; anim.SetBool("DyingAnim", true); FB = false; secondary.PlayOneShot(roar, PlayerPrefs.GetFloat("Effects", 0.5f)); } }
void Idle() { Moving(); if (movingRight && Vector3.Distance(gameObject.transform.position, leftpos) >= 1) { movingRight = true; localScale.x *= -1; } else if (!movingRight && Vector3.Distance(gameObject.transform.position, rightpos) >= 1) { movingRight = false; localScale.x *= -1; } if (vision.sighted == true) { currentaction = Chase; } }
public void HFire2() { bool finished = false; location.currentTarget = HfireList2[HFireListIndex2]; if (location.IsCloseToTarget()) { if (HFireListIndex2 <= HfireList2.Capacity - 2) { HFireListIndex2++; if (HFireListIndex2 == 1 || HFireListIndex2 == 3) { FB = true; source.UnPause(); localScale.y *= -1; } else { FB = false; source.Pause(); } if (HFireListIndex2 == 1) { gameObject.transform.rotation = back.transform.rotation; } } else { finished = true; HFireListIndex2 = 0; } } if (finished) { { finished = false; currentaction = Idle; nextaction = Spin; gameObject.transform.rotation = Quaternion.identity; } } }
void Start() { fre = firefrequency; slider.maxValue = StartingHealth; currenttime = downtime; currentaction = Begin; location.movespeed = speed; location.WithinRange = range; nextaction = HFire; v = volley; VA = volleyAmount; localScale = transform.localScale; slider.value = 0; source.volume = PlayerPrefs.GetFloat("Effects"); source.Play(); norm = slide.color; flash = Color.red; currentflashtime = flashtime; }
public void fball() { if (!spinning) { location.currentTarget = blitzpoint; } if (Vector3.Distance(blitzpoint.transform.position, gameObject.transform.position) <= 0.3f) { spinning = true; } if (spinning) { v -= Time.fixedDeltaTime; if (v <= 0 && VA > 0) { secondary.PlayOneShot(fbs, PlayerPrefs.GetFloat("Effects")); anim.SetTrigger("fballtrig"); if (VA % 2 == 0) { GameObject clone; clone = Instantiate(fireball, Mouth.transform.position, Mouth.transform.rotation); v = volley; VA--; } else { GameObject clone; clone = Instantiate(fireball2, Mouth.transform.position, Mouth.transform.rotation); v = volley; VA--; } } if (VA <= 0) { spinning = false; v = volley; VA = volleyAmount; nextaction = HFire; currentaction = Idle; } } }
public virtual void Recoil() { candamage = false; if (FF) { groundcheck.gameObject.SetActive(false); anim.SetBool("GettingHitAnim", true); rb.AddForce(Vector3.up * (knockback * 2)); if (KBdir) { rb.AddForce(Vector3.right * knockback); } else { rb.AddForce(Vector3.right * -knockback); } attacked = true; anim.SetBool("GettingHitAnim", true); Debug.Log("hit!!!!!!"); FF = false; } if (rb.velocity.y <= 0) { groundcheck.gameObject.SetActive(true); } if (groundcheck.bash) { FF = true; attacked = false; rb.velocity = new Vector3(0, 0, 0); if (Health <= 0) { currentaction = Die; } else { candamage = true; currentaction = Default; anim.SetBool("GettingHitAnim", false); } } }
public void Spin2() { if (ff) { FB = true; ff = false; gameObject.transform.SetParent(SpinPoint.transform); spinning = true; nextaction = fballStart; } if (gameObject.transform.position.x <= SpinPoint.transform.position.x) { passed = true; } if (passed && Vector3.Distance(back.transform.position, gameObject.transform.position) <= 1) { if (!spincycle) { gameObject.transform.SetParent(null); gameObject.transform.rotation = Quaternion.identity; spinning = false; currentaction = Idle; passed = false; FB = false; ff = true; if (phase2) { spincycle = true; } } else { currentaction = Spin3; ff = true; passed = false; } } }
public void HFire() { bool finished = false; location.currentTarget = HfireList[HFireListIndex]; if (location.IsCloseToTarget()) { if (HFireListIndex <= HfireList.Capacity - 2) { HFireListIndex++; if (HFireListIndex == 1 || HFireListIndex == 3) { FB = true; } else { FB = false; } } else { finished = true; HFireListIndex = 0; } } if (finished) { if (phase2) { currentaction = HFire2; finished = false; FB = false; } else { finished = false; currentaction = Idle; nextaction = Spin; } } }
public void Spin3() { if (ff) { gameObject.transform.SetParent(SpinPoint2.transform); localScale.y *= -1; ff = false; } if (gameObject.transform.position.x <= SpinPoint.transform.position.x) { passed = true; } if (passed && Vector3.Distance(back2.transform.position, gameObject.transform.position) <= 1) { currentaction = Spin2; spincycle = false; passed = false; gameObject.transform.SetParent(SpinPoint.transform); localScale.y *= -1; } }
public void Idle() { location.currentTarget = IdleList[IdleListIndex]; currenttime -= Time.fixedDeltaTime; FB = false; if (location.IsCloseToTarget()) { if (IdleListIndex >= IdleList.Capacity - 1) { IdleListIndex = 0; } else { IdleListIndex++; } if (currenttime <= 0) { currenttime = downtime; currentaction = nextaction; } } }
public override void Damage(bool KB) { base.Damage(KB); currentaction = Recoil; }
public void fballStart() { VA = volleyAmount; currentaction = fball; }