Exemple #1
0
 public override void Launch()
 {
     base.Launch();
     TrailEffect = EffectEmitter.EmitParticle("trail_arrow", Vector3.zero, Vector3.zero, transform);
     Force       = (transform.position - ShootPos).normalized * AmmoSpeed;
     MyRigi.AddForce(Force);
 }
Exemple #2
0
 public override void Launch()
 {
     base.Launch();
     EffectEmitter.EmitParticle("trail_shiny", Vector3.zero, Vector3.zero, transform);
     BattleManager.SetRecord("ShootTimes", 1, Operator.Plus);
     MyAudio.PlaySound("sfx_shoot");
 }
Exemple #3
0
 public virtual void PowerUp()
 {
     if (SpeedyFlyingAudio != null)
     {
         MyAudio.PlayLoopSound(SpeedyFlyingAudio, string.Format("{0}_{1}", name.ToString(), "SpeedyFlyingAudio"));
     }
     EffectEmitter.EmitParticle("trail_star", Vector3.zero, Vector3.zero, transform);
 }
Exemple #4
0
 protected virtual bool DeathCheck()
 {
     if (Health <= 0)
     {
         IsAlive = false;
         EffectEmitter.EmitParticle("deathEffect", transform.position, Vector3.zero, null);
         BattleCanvas.ShowRole(MyForce, false);
         MyAudio.PlaySound(DieAduio);
         BattleManager.DestroyAllAmmo();
     }
     else
     {
         IsAlive = true;
     }
     return(!IsAlive);
 }
Exemple #5
0
    protected override void OnTriggerEnter2D(Collider2D _col)
    {
        if (!IsLaunching)
        {
            return;
        }
        base.OnTriggerEnter2D(_col);
        switch (_col.gameObject.tag)
        {
        case "Player":
            MyAudio.PlaySound(HitAduio);
            EffectEmitter.EmitParticle("bloodEffect", transform.position, new Vector3(0, 0, 180 - MyMath.GetAngerFormTowPoint2D(BattleManager.MyPlayerRole.transform.position, transform.position)), null);
            BattleManager.MyPlayerRole.BeStruck(Damage);
            SelfDestroy();
            break;

        case "PlayerShield":
            MyAudio.PlaySound(HitShieldAduio);
            EffectEmitter.EmitParticle("shieldhit", transform.position, new Vector3(0, 0, 180 - MyMath.GetAngerFormTowPoint2D(BattleManager.MyPlayerRole.transform.position, transform.position)), null);
            BattleManager.MyPlayerRole.ShieldBeSruck(Damage);
            SelfDestroy();
            break;


        case "LeftCol":
            MyAudio.PlaySound(HitWallAduio);
            EffectEmitter.EmitParticle("bounceEffect", transform.position, new Vector3(0, 0, 180), null);
            CameraPrefab.DoAction("Shake", 0);
            if (CurBounceTimes == 0)
            {
                MyRigi.velocity = _col.GetComponent <NormalWallObj>().GetDragForce(MyRigi.velocity, 0);
            }
            if (Bounce())
            {
                MyRigi.velocity = _col.GetComponent <NormalWallObj>().GetVelocity(MyRigi.velocity);
                Vector2 dir   = MyRigi.velocity;
                float   angle = Mathf.Atan2(dir.y, dir.x) * Mathf.Rad2Deg + 180;
                AmmoSR.transform.rotation      = Quaternion.Euler(AmmoSR.transform.localRotation.x, AmmoSR.transform.localRotation.y, angle);
                TrailEffect.transform.rotation = Quaternion.Euler(AmmoSR.transform.localRotation.x, AmmoSR.transform.localRotation.y, angle);
            }

            break;

        case "RightCol":
            MyAudio.PlaySound(HitWallAduio);
            EffectEmitter.EmitParticle("bounceEffect", transform.position, Vector3.zero, null);
            CameraPrefab.DoAction("Shake", 0);
            if (CurBounceTimes == 0)
            {
                MyRigi.velocity = _col.GetComponent <NormalWallObj>().GetDragForce(MyRigi.velocity, 0);
            }
            if (Bounce())
            {
                MyRigi.velocity = _col.GetComponent <NormalWallObj>().GetVelocity(MyRigi.velocity);
                Vector2 dir   = MyRigi.velocity;
                float   angle = Mathf.Atan2(dir.y, dir.x) * Mathf.Rad2Deg + 180;
                AmmoSR.transform.rotation      = Quaternion.Euler(AmmoSR.transform.localRotation.x, AmmoSR.transform.localRotation.y, angle);
                TrailEffect.transform.rotation = Quaternion.Euler(AmmoSR.transform.localRotation.x, AmmoSR.transform.localRotation.y, angle);
            }
            break;

        case "TopCol":
            MyAudio.PlaySound(HitWallAduio);
            EffectEmitter.EmitParticle("bounceEffect", transform.position, new Vector3(0, 0, 90), null);
            CameraPrefab.DoAction("Shake", 0);
            if (CurBounceTimes == 0)
            {
                MyRigi.velocity = _col.GetComponent <NormalWallObj>().GetDragForce(MyRigi.velocity, 0);
            }
            if (Bounce())
            {
                MyRigi.velocity = _col.GetComponent <NormalWallObj>().GetVelocity(MyRigi.velocity);
                Vector2 dir   = MyRigi.velocity;
                float   angle = Mathf.Atan2(dir.y, dir.x) * Mathf.Rad2Deg + 180;
                AmmoSR.transform.rotation      = Quaternion.Euler(AmmoSR.transform.localRotation.x, AmmoSR.transform.localRotation.y, angle);
                TrailEffect.transform.rotation = Quaternion.Euler(AmmoSR.transform.localRotation.x, AmmoSR.transform.localRotation.y, angle);
            }

            break;

        case "BotCol":
            MyAudio.PlaySound(HitWallAduio);
            EffectEmitter.EmitParticle("bounceEffect", transform.position, new Vector3(0, 0, 270), null);
            CameraPrefab.DoAction("Shake", 0);
            if (CurBounceTimes == 0)
            {
                MyRigi.velocity = _col.GetComponent <NormalWallObj>().GetDragForce(MyRigi.velocity, 0);
            }
            if (Bounce())
            {
                MyRigi.velocity = _col.GetComponent <NormalWallObj>().GetVelocity(MyRigi.velocity);
                Vector2 dir   = MyRigi.velocity;
                float   angle = Mathf.Atan2(dir.y, dir.x) * Mathf.Rad2Deg + 180;
                AmmoSR.transform.rotation      = Quaternion.Euler(AmmoSR.transform.localRotation.x, AmmoSR.transform.localRotation.y, angle);
                TrailEffect.transform.rotation = Quaternion.Euler(AmmoSR.transform.localRotation.x, AmmoSR.transform.localRotation.y, angle);
            }
            break;

        default:
            break;
        }
    }
Exemple #6
0
 public virtual void BeStruck(int _dmg)
 {
     EffectEmitter.EmitParticle("hitEffect", transform.position, Vector3.zero, null);
     CameraPrefab.DoAction("Shake2", 0);
     ReceiveDmg(_dmg);
 }
Exemple #7
0
    protected override void OnTriggerEnter2D(Collider2D _col)
    {
        base.OnTriggerEnter2D(_col);
        switch (_col.gameObject.tag)
        {
        case "BounceWall":
            MyAudio.PlaySound(HitHardWallAduio);
            PowerUp();
            MyRigi.velocity = _col.GetComponent <BounceWallObj>().GetVelocity(MyRigi.velocity);
            break;

        case "LeftCol":
            MyAudio.PlaySound(HitWallAduio);
            EffectEmitter.EmitParticle("bounceEffect", transform.position, new Vector3(0, 0, 180), null);
            CameraPrefab.DoAction("Shake", 0);
            if (CurBounceTimes == 0)
            {
                MyRigi.velocity = _col.GetComponent <NormalWallObj>().GetDragForce(MyRigi.velocity, Dragproportion);
            }
            if (Bounce())
            {
                MyRigi.velocity = _col.GetComponent <NormalWallObj>().GetVelocity(MyRigi.velocity);
            }
            break;

        case "RightCol":
            MyAudio.PlaySound(HitWallAduio);
            EffectEmitter.EmitParticle("bounceEffect", transform.position, Vector3.zero, null);
            CameraPrefab.DoAction("Shake", 0);
            if (CurBounceTimes == 0)
            {
                MyRigi.velocity = _col.GetComponent <NormalWallObj>().GetDragForce(MyRigi.velocity, Dragproportion);
            }
            if (Bounce())
            {
                MyRigi.velocity = _col.GetComponent <NormalWallObj>().GetVelocity(MyRigi.velocity);
            }
            break;

        case "TopCol":
            MyAudio.PlaySound(HitWallAduio);
            EffectEmitter.EmitParticle("bounceEffect", transform.position, new Vector3(0, 0, 90), null);
            CameraPrefab.DoAction("Shake", 0);
            if (CurBounceTimes == 0)
            {
                MyRigi.velocity = _col.GetComponent <NormalWallObj>().GetDragForce(MyRigi.velocity, Dragproportion);
            }
            if (Bounce())
            {
                MyRigi.velocity = _col.GetComponent <NormalWallObj>().GetVelocity(MyRigi.velocity);
            }
            break;

        case "BotCol":
            MyAudio.PlaySound(HitWallAduio);
            EffectEmitter.EmitParticle("bounceEffect", transform.position, new Vector3(0, 0, 270), null);
            CameraPrefab.DoAction("Shake", 0);
            if (CurBounceTimes == 0)
            {
                MyRigi.velocity = _col.GetComponent <NormalWallObj>().GetDragForce(MyRigi.velocity, Dragproportion);
            }
            if (Bounce())
            {
                MyRigi.velocity = _col.GetComponent <NormalWallObj>().GetVelocity(MyRigi.velocity);
            }
            break;

        case "EnemyShield":
            if (IsHitTarget)
            {
                return;
            }
            MyAudio.PlaySound(HitShieldAduio);
            Vector2 effectPos = Vector2.Lerp(BattleManager.MyEnemyRole.transform.position, transform.position, 0.8f);
            EffectEmitter.EmitParticle("shieldhit", effectPos, new Vector3(0, 0, 180 - MyMath.GetAngerFormTowPoint2D(BattleManager.MyEnemyRole.transform.position, transform.position)), null);
            BattleManager.MyEnemyRole.ShieldBeSruck(Damage);

            AmmoHitCondition = HitCondition.HitShell;
            SelfDestroy();
            IsHitTarget = true;
            break;

        case "Monster":
            if (IsHitTarget)
            {
                return;
            }
            MyAudio.PlaySound(HitAduio);
            EffectEmitter.EmitParticle("bloodEffect", transform.position, new Vector3(0, 0, 180 - MyMath.GetAngerFormTowPoint2D(BattleManager.MyEnemyRole.transform.position, transform.position)), null);
            BattleManager.MyEnemyRole.BeStruck(Damage);

            AmmoHitCondition = HitCondition.Hit;
            SelfDestroy();
            IsHitTarget = true;
            break;

        default:
            break;
        }
    }