Exemplo n.º 1
0
    protected virtual void OnTriggerEnter(Collider hit)
    {
        if (hit.gameObject.CompareTag("Bullet"))
        {
            k514BulletBridge tmp = hit.GetComponent <k514BulletBridge>();
            if (!tmp.isEnemyShot() && !tmp.GetOnceTrig())
            {
                tmp.DoInteract();
                if (!isBoss)
                {
                    k514SystemManager.EffectMgr.CastEffect(EFFECT_TYPE.HIT, transform.position + Vector3.up * 0.4f);
                }
                k514SystemManager.InteractMgr.GetPlayerTransform().GetComponent <k514PlayerController>().SCORE_STORAGE += Random.Range(30, 60);
                k514SystemManager.InteractMgr.GetPlayerTransform().GetComponent <k514PlayerController>().SP            += Random.Range(0.003f, 0.005f);
                this.DoInteract_HP(tmp.GetDamage());
            }
        }

        if (hit.gameObject.CompareTag("Bomb"))
        {
            Debug.Log("in!");
            k514MusouFuuin tmp2 = hit.GetComponent <k514MusouFuuin>();
            bombs_check.Add(tmp2.GetID(), tmp2);
        }
    }
Exemplo n.º 2
0
    public Transform CreateBullet <T>(BULLET_TYPE type, Vector3 dir, float moveTime, float speed, Transform TargetPlace = null, int lifeSpan = 100, float damage = 5f, bool whos_shot = true) where T : k514BulletBridge
    {
        int index = (int)type;

        if (index >= pfab.Length)
        {
            index = pfab.Length;
        }
        Transform        tmp  = null;
        T                tmp2 = null;
        k514BulletBridge tmp3 = null;

        int Cnt = bulletDisablePool[index].Count;

        if (Cnt < 1)
        {
            tmp  = Instantiate(pfab[index]);
            tmp2 = tmp.gameObject.AddComponent <T>();
            tmp2.SetID(index);
        }
        else
        {
            tmp3 = bulletDisablePool[index][Cnt - 1];
            if (tmp3.GetType() == typeof(T))
            {
                tmp2 = (T)tmp3;
            }
            else
            {
                tmp = tmp3.transform;
                Destroy(tmp.GetComponent <k514BulletBridge>());
                tmp2 = tmp.gameObject.AddComponent <T>();
            }
            tmp = tmp2.transform;
            tmp.gameObject.SetActive(true);
            bulletDisablePool[index].RemoveAt(Cnt - 1);
        }

        tmp2.Init(dir, moveTime, speed, lifeSpan, damage, whos_shot);

        if (TargetPlace != null)
        {
            tmp2.SetTargetTransform(TargetPlace);
        }
        return(tmp);
    }
Exemplo n.º 3
0
 protected void OnTriggerEnter(Collider hit)
 {
     if (hit.gameObject.CompareTag("Bullet") && !InvisibleTrig)
     {
         k514BulletBridge tmp = hit.gameObject.GetComponent <k514BulletBridge>();
         if (tmp.isEnemyShot() && !tmp.GetOnceTrig())
         {
             tmp.DoInteract();
             ZANKI--;
             InvisibleTrig = true;
             if (ZANKI < 0)
             {
                 StartCoroutine(GameOver());
             }
             else
             {
                 StartCoroutine(Invisible());
             }
             k514SystemManager.SoundMgr.PlayAudioClip(SFX_TYPE_BODY.PICHU);
             k514SystemManager.UI_SpecaMgr.Zanki_UI_Update();
             k514SystemManager.EffectMgr.CastEffect(EFFECT_TYPE.PHIT, transform.position + Vector3.up * 0.4f);
         }
     }
 }