public override Spawn GetSpawn(int type) { Dictionary <int, EnemySpawn> enemySpawns = new Dictionary <int, EnemySpawn>(); double random = RandomGenerator.Instance.GetDouble(); IMovement movement; if (random < 0.5) { movement = new StraightMovement(2); } else { movement = new FastWithBreaksMovement(2); } EnemySpawn p = null; if (enemySpawns.ContainsKey(type)) { p = enemySpawns[type]; } else { p = new EnemySpawn(); p.Movement = movement; p.Toughness = type; enemySpawns.Add(type, p); } return(p); }
public static GenericMovement MovementFromStruct(ManeuverHolder movementStruct) { GenericMovement result = null; if (movementStruct.Bearing == ManeuverBearing.Straight) { result = new StraightMovement(movementStruct.SpeedIntUnsigned, movementStruct.Direction, movementStruct.Bearing, movementStruct.ColorComplexity); } else if (movementStruct.Bearing == ManeuverBearing.KoiogranTurn) { result = new KoiogranTurnMovement(movementStruct.SpeedIntUnsigned, movementStruct.Direction, movementStruct.Bearing, movementStruct.ColorComplexity); } else if (movementStruct.Bearing == ManeuverBearing.Turn) { result = new TurnMovement(movementStruct.SpeedIntUnsigned, movementStruct.Direction, movementStruct.Bearing, movementStruct.ColorComplexity); } else if (movementStruct.Bearing == ManeuverBearing.Bank) { result = new BankMovement(movementStruct.SpeedIntUnsigned, movementStruct.Direction, movementStruct.Bearing, movementStruct.ColorComplexity); } else if (movementStruct.Bearing == ManeuverBearing.SegnorsLoop) { result = new SegnorsLoopMovement(movementStruct.SpeedIntUnsigned, movementStruct.Direction, movementStruct.Bearing, movementStruct.ColorComplexity); } else if (movementStruct.Bearing == ManeuverBearing.SegnorsLoopUsingTurnTemplate) { result = new SegnorsLoopUsingTurnTemplateMovement(movementStruct.SpeedIntUnsigned, movementStruct.Direction, movementStruct.Bearing, movementStruct.ColorComplexity); } else if (movementStruct.Bearing == ManeuverBearing.TallonRoll) { result = new TallonRollMovement(movementStruct.SpeedIntUnsigned, movementStruct.Direction, movementStruct.Bearing, movementStruct.ColorComplexity); } else if (movementStruct.Bearing == ManeuverBearing.Stationary) { result = new StationaryMovement(movementStruct.SpeedIntUnsigned, movementStruct.Direction, movementStruct.Bearing, movementStruct.ColorComplexity); } else if (movementStruct.Bearing == ManeuverBearing.SideslipBank) { result = new SideslipBankMovement(movementStruct.SpeedIntUnsigned, movementStruct.Direction, movementStruct.Bearing, movementStruct.ColorComplexity); } else if (movementStruct.Bearing == ManeuverBearing.SideslipTurn) { result = new SideslipTurnMovement(movementStruct.SpeedIntUnsigned, movementStruct.Direction, movementStruct.Bearing, movementStruct.ColorComplexity); } else if (movementStruct.Bearing == ManeuverBearing.ReverseStraight) { if (movementStruct.Direction == ManeuverDirection.Forward) { result = new ReverseStraightMovement(movementStruct.SpeedIntUnsigned, movementStruct.Direction, movementStruct.Bearing, movementStruct.ColorComplexity); } else { result = new ReverseBankMovement(movementStruct.SpeedIntUnsigned, movementStruct.Direction, movementStruct.Bearing, movementStruct.ColorComplexity); } } return(result); }
private static void AssignIonizationManeuver(GenericShip ship) { GenericMovement ionizedMovement = new StraightMovement(1, ManeuverDirection.Forward, ManeuverBearing.Straight, RuleSet.Instance.IonManeuverComplexity) { IsRevealDial = false, IsIonManeuver = true }; ship.SetAssignedManeuver(ionizedMovement); }
protected override void OnDeath() { Vector3 pos = transform.position; StraightMovement debris1 = Instantiate(debrisPrefab, new Vector3(pos.x + debrisSpread, pos.y, pos.z), Quaternion.identity); StraightMovement debris2 = Instantiate(debrisPrefab, new Vector3(pos.x - debrisSpread, pos.y, pos.z), Quaternion.identity); debris1.SetSpeedAndAngle(1f, debrisAngle); debris2.SetSpeedAndAngle(1f, -debrisAngle); }
private void AssignWhiteForwardOneManeuver(GenericShip ship) { GenericMovement ionizedMovement = new StraightMovement(1, ManeuverDirection.Forward, ManeuverBearing.Straight, ManeuverColor.White) { IsRealMovement = false }; ship.SetAssignedManeuver(ionizedMovement); ship.OnManeuverIsReadyToBeRevealed -= AssignWhiteForwardOneManeuver; }
public DispenserMovePattern(Vector3 centerPos, float radius, float speed, Dispenser tile) { this.radius = radius; this.speed = speed; this.centerPos = centerPos; startPos = centerPos + radius * new Vector3(0, 0, 1); left = new StraightMovement(BaseTile.eDirection.left, centerPos, Game.BOARD.GetTileLengths().x / 2.0f, 0.6f); down = new StraightMovement(BaseTile.eDirection.down, centerPos, Game.BOARD.GetTileLengths().x / 2.0f, 0.6f); right = new StraightMovement(BaseTile.eDirection.right, centerPos, Game.BOARD.GetTileLengths().x / 2.0f, 0.6f); this.tile = tile; }
// Why do these exist? Do we really need them? I mean, look up... ^ ^ ^ /*public string getStart() * { * switch(this.start) * { * case eDirection.down: * return "down"; * case eDirection.up: * return "top"; * case eDirection.left: * return "left"; * case eDirection.right: * return "right"; * } * return "none"; * } * * public string getEnd() * { * switch (this.end) * { * case eDirection.down: * return "down"; * case eDirection.up: * return "top"; * case eDirection.left: * return "left"; * case eDirection.right: * return "right"; * } * return "none"; * }*/ public override void InitMovementPattern() { bool straight = (start == eDirection.up && end == eDirection.down) || (start == eDirection.left && end == eDirection.right) || (start == eDirection.right && end == eDirection.left) || (start == eDirection.down && end == eDirection.up); Vector3 centerPos = new Vector3(transform.position.x, Y_VALUE, transform.position.z); if (straight) { movePattern = new StraightMovement(end, centerPos, Game.BOARD.GetTileLengths().x / 2.0f, 0.6f); } else { movePattern = new TurningMovement(centerPos, Game.BOARD.GetTileLengths().x / 2.0f, start, end, 0.6f); } }
void Kill() { SineMovement sm = GetComponent <SineMovement>(); if (sm != null) { sm.enabled = false; } StraightMovement strm = GetComponent <StraightMovement>(); if (strm != null) { strm.enabled = false; } FollowObject fo = GetComponent <FollowObject>(); if (fo != null) { fo.enabled = false; } CircularMovement cm = GetComponent <CircularMovement>(); if (cm != null) { cm.enabled = false; } //Disable the renderer and the Collider GetComponent <SpriteRenderer>().enabled = false; GetComponent <Collider2D>().enabled = false; if (m_particle != null) { m_particle = ObjectPool.Instantiate(m_particle, transform.position, transform.rotation); StartCoroutine(KillAnimation()); } else { ObjectPool.Kill(gameObject); } }
private static void AssignIonizationManeuver(GenericShip ship) { GenericMovement ionizedMovement = new StraightMovement( 1, ManeuverDirection.Forward, ManeuverBearing.Straight, ship.GetColorComplexityOfManeuver( new ManeuverHolder( ManeuverSpeed.Speed1, ManeuverDirection.Forward, ManeuverBearing.Straight, Edition.Current.IonManeuverComplexity ) ) ) { IsRevealDial = false, IsIonManeuver = true }; ship.SetAssignedManeuver(ionizedMovement); }
/*IEnumerator DamagedAnimation() { * for (float f = 0; f <= 1; f += 0.2f) { * m_renderer.color = new Color(215f / 255 * f, 63f / 255 * f, 63f / 255 * f); * Debug.Log("CHANGE: " + m_renderer.color.r + ", " + m_renderer.color.g + ", " + m_renderer.color.b); * yield return new WaitForSeconds(0.1f); * } * * for (float f = 1; f >= 0; f -= 0.2f) { * m_renderer.color = new Color(215f / 255 * f, 63f / 255 * f, 63f / 255 * f); * Debug.Log("CHANGE BACK: " + m_renderer.color.r + ", " + m_renderer.color.g + ", " + m_renderer.color.b); * yield return new WaitForSeconds(0.1f); * } * }*/ void Kill() { SineMovement sm = GetComponent <SineMovement>(); if (sm != null) { sm.enabled = false; } StraightMovement strm = GetComponent <StraightMovement>(); if (strm != null) { strm.enabled = false; } FollowObject fo = GetComponent <FollowObject>(); if (fo != null) { fo.enabled = false; } CircularMovement cm = GetComponent <CircularMovement>(); if (cm != null) { cm.enabled = false; } //Disable the renderer and the Collider GetComponent <SpriteRenderer>().enabled = false; GetComponent <Collider2D>().enabled = false; m_particle.Play(); StartCoroutine(KillAnimation()); }
private void OnEnable() { _straightMovement = (StraightMovement)target; SetHelpboxText(); }