public override void Enter() { prepPhase = true; jumpPhase = false; hitPhase = false; retPhase = false; t0 = 0; t1 = 0; t2 = 0; t3 = 0; r1 = 0; r2 = 0; target = Boss.targets[0]; endLocation = FindEndLocation(target); startPos = Boss.transform.position; targetPos = target.transform.position; endPos = endLocation.transform.position; SM.PlayAnimation(Tank_StateManager.AnimationState.Tank_Jump_start); Boss.SetSound(2); Boss.PlaySound(); if (startPos.x > endPos.x) { Boss.LookLeft(); } else { Boss.LookRight(); } }
private Location_Boss[] GetPossibleLocs(Location_Boss curr) { switch (curr.GetName()) { case "A": return(new Location_Boss[] { Boss.BossLocAB, Boss.BossLocB, Boss.BossLocC }); case "B": return(new Location_Boss[] { Boss.BossLocA, Boss.BossLocAB, Boss.BossLocD }); case "C": return(new Location_Boss[] { Boss.BossLocA, Boss.BossLocCD, Boss.BossLocD }); case "D": return(new Location_Boss[] { Boss.BossLocB, Boss.BossLocCD, Boss.BossLocC }); case "AB": return(new Location_Boss[] { Boss.BossLocA, Boss.BossLocB, Boss.BossLocCD }); case "CD": return(new Location_Boss[] { Boss.BossLocC, Boss.BossLocD, Boss.BossLocAB }); default: return(new Location_Boss[] { Boss.currentBossLocation }); } }
private void StopDriveBy(Location_Boss end) { isDriveBy = false; startDriveLoc = null; endDriveLoc = null; currentBossLocation = end; this.transform.position = currentBossLocation.transform.position; }
private void DriveBy(Location_Boss start, Location_Boss end) { //this.transform.position = Vector2.MoveTowards(this.transform.position, end.transform.position, step); Vector2 direction = (end.transform.position - this.transform.position).normalized; rb.velocity = DriveSpeed * direction; if (Vector2.Distance(this.transform.position, end.transform.position) < ArrivalThreshhold) { StopDriveBy(end); } }
public override void Enter() { Boss.SetSound(2); Boss.PlaySound(); SM.PlayAnimation(Tank_StateManager.AnimationState.Tank_Driving); tPrep = 0; t = 0; r = 0; prepPhase = true; possibleLocs = GetPossibleLocs(Boss.currentBossLocation); target = possibleLocs[Random.Range(0, possibleLocs.Length)]; startPos = Boss.currentBossLocation.transform.position; endPos = target.transform.position; Boss.isDriving = true; }
public void StartDriveBy(Location_Boss start, Location_Boss end) { isDriveBy = true; startDriveLoc = start; endDriveLoc = end; this.transform.position = start.transform.position; if (start.transform.position.x > end.transform.position.x) { LookLeft(); } else { LookRight(); } }
private void Awake() { sp = this.GetComponent <SpriteRenderer>(); rb = this.GetComponent <Rigidbody2D>(); Manager = this.GetComponent <Tank_StateManager>(); player = FindObjectOfType <Player>(); pLocA = PlayerLocations[0]; pLocB = PlayerLocations[1]; pLocC = PlayerLocations[2]; pLocD = PlayerLocations[3]; BossLocations = new Location_Boss[] { BossLocA, BossLocB, BossLocC, BossLocD, BossLocAB, BossLocCD }; currentBossLocation = BossLocC; DriveSpeed = DriveSpeed_1; DriveOffDelay = DriveOffDelay_1; health = MaxHealth; Phase2_Thresh = MaxHealth / 2; isAlive = true; }