Example #1
0
    void OnTriggerEnter2D(Collider2D collide)
    {
        if (collide.gameObject.tag == "Bullet")
        {
            return;
        }
        BeseObject baseObject = collide.gameObject.GetComponent <BeseObject>();

        if (baseObject)
        {
            if (BeseObject.CollideType.Neutral == baseObject.colideType)
            {
                baseObject.BeDamaged(status);

                GameObject.Find("HitEffectManager").GetComponent <HitEffectManager>().HitEffectPlay(transform.position);
                battleSoundManager.PlaySound(BattleSoundManager.Type.BulletHit);
                Destroy(this.gameObject);
            }
            else if (colideType != baseObject.colideType &&
                     BeseObject.CollideType.None != baseObject.colideType)
            {
                baseObject.BeDamaged(status);

                GameObject.Find("HitEffectManager").GetComponent <HitEffectManager>().HitEffectPlay(transform.position);
                battleSoundManager.PlaySound(BattleSoundManager.Type.BulletHit);
                Destroy(this.gameObject);
            }
        }
    }
Example #2
0
    public void Instance(BeseObject obj, float radian)
    {
        GameObject instance;

        switch (obj.status.bulletElement)
        {
        case BeseObject.Elements.Nomal:
            instance = Instantiate(nomalbulletPrefab);
            battleSoundManager.PlaySound(BattleSoundManager.Type.NormalBullet, true);
            break;

        case BeseObject.Elements.Fire:
            instance = Instantiate(firebulletPrefab);
            battleSoundManager.PlaySound(BattleSoundManager.Type.FireBullet, true);
            break;

        case BeseObject.Elements.Water:
            instance = Instantiate(waterbulletPrefab);
            battleSoundManager.PlaySound(BattleSoundManager.Type.WaterBullet, true);
            break;

        case BeseObject.Elements.Wood:
            instance = Instantiate(woodbulletPrefab);
            battleSoundManager.PlaySound(BattleSoundManager.Type.WoodBullet, true);
            break;

        default:
            return;

            break;
        }

        // 場所
        instance.gameObject.transform.position = obj.gameObject.transform.position;

        // 速度
        float speed = (obj.status.valueStatus.bounceSpeed + obj.status.upSkillStatus.UpBounceSpeed) * obj.status.upSkillStatus.MAG_BounceSpeed;
        float dirX  = Mathf.Cos(radian);
        float dirY  = Mathf.Sin(radian);

        instance.GetComponent <Bullet>().velocity = new Vector2(dirX * speed, dirY * speed);

        // 当たり判定の種類を設定
        instance.GetComponent <Bullet>().colideType = obj.GetComponent <BeseObject>().colideType;
        // ステータスの反映
        instance.GetComponent <Bullet>().status = obj.GetComponent <BeseObject>().status.Clone();

        // 親の設定
        instance.transform.SetParent(GameObject.Find("TouchArea").transform);

        // 角度
        instance.gameObject.transform.Rotate(new Vector3(0.0f, 0.0f, radian * Mathf.Rad2Deg - 90.0f));
    }
Example #3
0
 // Use this for initialization
 void Start()
 {
     battleSoundManager = GameObject.Find("BattleSoundManager").GetComponent <BattleSoundManager>();
     battleSoundManager.StopSound(BattleSoundManager.Type.BossBGM);
     battleSoundManager.PlaySound(BattleSoundManager.Type.GameOver, true);
     image       = GetComponent <Image>();
     image.color = new Color(1, 1, 1, alpha);
     blur.isBlur();
 }
Example #4
0
    private void OnPressed(object sender, EventArgs e)
    {
        GameObject player = GameObject.Find("Player");

        if (player)
        {
            player.GetComponent <Character>().status.bulletElement = elements;
            battleSoundManager.PlaySound(BattleSoundManager.Type.ChangeElement, true);
        }
    }
Example #5
0
 // Update is called once per frame
 void Update()
 {
     foreach (Vector3 pos in poslist)
     {
         hitEffect.transform.position = pos + _camera.transform.forward * 10;
         hitEffect.Emit(emitCount);
         battleSoundManager.PlaySound(BattleSoundManager.Type.BulletHit, true);
     }
     poslist.Clear();
 }
Example #6
0
    public void NextWave(GameObject nextWave)
    {
        nextWaveBuf = nextWave;
        // フラグにVisibleのフラグを立てる
        bitFlag            |= BitFlag.Visible;
        alpha               = 0.0f;
        upDownFlashAlphaBuf = -upDownFlashAlpha;
        wave++;

        nextWave.GetComponent <Wave>().fontWave = this;

        if (!nextWave.GetComponent <Wave>().nextWave)
        {
            // フラグにBossのフラグを立てる
            bitFlag |= BitFlag.Boss;
            battleSoundManager.StopSound(BattleSoundManager.Type.BattleBGM);
            battleSoundManager.PlaySound(BattleSoundManager.Type.BossBGM);
        }
    }
 public void SkillEffectPlay()
 {
     skillEffect.Emit(1);
     battleSoundManager.PlaySound(BattleSoundManager.Type.PlaySkill, true);
 }
Example #8
0
    // Update is called once per frame
    void Update()
    {
        countToDelayTime += Time.deltaTime;
        if (countToDelayTime >= delayTime)
        {
            countToDelayTime = 0.0f;
            int valueBuf = (int)(value * doubleValueBuf);
            switch (type)
            {
            case 0:
                // 経験値の処理
                if ((questInfo.experience - valueBuf) < 0)
                {
                    playerInfo.currentExperience += questInfo.experience;
                    questInfo.experience          = 0;
                }
                else
                {
                    questInfo.experience         -= valueBuf;
                    playerInfo.currentExperience += valueBuf;
                    battleSoundManager.PlaySound(BattleSoundManager.Type.Up);
                }
                break;

            case 1:
                // お金の処理
                if ((questInfo.gold - valueBuf) < 0)
                {
                    playerInfo.gold += questInfo.gold;
                    questInfo.gold   = 0;
                }
                else
                {
                    questInfo.gold  -= valueBuf;
                    playerInfo.gold += valueBuf;
                    battleSoundManager.PlaySound(BattleSoundManager.Type.Up);
                }
                break;
            }
        }

        // レベルを上げる
        if ((playerInfo.currentExperience / playerInfo.nextExperience) != 0)
        {
            int upLevel = playerInfo.currentExperience / playerInfo.nextExperience;
            playerInfo.level            += upLevel;
            playerInfo.currentExperience = playerInfo.currentExperience % playerInfo.nextExperience;
        }

        lv.num             = playerInfo.level;
        experience.num     = playerInfo.currentExperience;
        nextExperience.num = playerInfo.nextExperience;
        gold.num           = playerInfo.gold;

        countToDoubleTime += Time.deltaTime;
        if ((type >= 0) &&
            (countToDoubleTime >= doubleTime))
        {
            countToDoubleTime = 0.0f;
            doubleValueBuf   *= doubleValue;
        }
    }