// Use this for initialization void Start () { swordAttack = GetComponent<SwordAttack>(); areaAttack = GetComponent<AreaAttack>(); missileAttack = GetComponent<MissileAttack>(); playerRotation = GetComponent<PlayerRotation>(); }
public void SpawnShotFromPool(Vector2 position, MissileAttack missileAttack, Transform target) { GameObject shot = GetObjectFromPool(position); if (shot != null) { shot.renderer.sortingLayerName = "Middleground"; shot.renderer.sortingOrder = 0; Missile missile = shot.GetComponent<Missile>(); missile.missileAttack = missileAttack; missile.target = target; SoundEffectScript.Instance.PlaySound(SoundEffectClip.ShipMissileAttack); } }
public void SpawnShotFromPool(Vector2 position, MissileAttack missileAttack, Transform target) { GameObject shot = GetObjectFromPool(position); if (shot != null) { shot.renderer.sortingLayerName = "Middleground"; shot.renderer.sortingOrder = 0; Missile missile = shot.GetComponent <Missile>(); missile.missileAttack = missileAttack; missile.target = target; SoundEffectScript.Instance.PlaySound(SoundEffectClip.ShipMissileAttack); } }
static void Main(string[] args) { MissileAttack ma1 = new MissileAttack(50, 20, DateTime.Now, PersonelRank.General, MissileType.Fire); ma1.Rank = PersonelRank.CommanderInChief; ma1.MissileType = MissileType.Nuclear; ma1.GRAVITATIONAL_ACCELERATION = 5.0; ma1.ExecuteAttack(); MissileAttackEncapsulated ma2 = new MissileAttackEncapsulated(50, 20, DateTime.Now, PersonelRank.General, MissileType.Fire); ma2.Rank = PersonelRank.CommanderInChief; ma2.MissileType = MissileType.Nuclear; ma2.GRAVITATIONAL_ACCELERATION = 5.0; ma2.ExecuteAttack(); }
protected override void TranslateRightOrDown() { if (!target.renderer.isVisible) { missileAttack = MissileAttack.Straight; } switch (missileAttack) { case MissileAttack.Straight: default: rigidbody2D.gravityScale = -2; break; case MissileAttack.Curve: Vector3 normalized = (target.position - transform.position).normalized; float angle = Mathf.Atan2(normalized.y, normalized.x) * Mathf.Rad2Deg; transform.rotation = Quaternion.Euler(0f, 0f, angle - 90f); break; } }