Example #1
0
        public override bool Hit(Bullet bullet, Vec2 hitPos)
        {
            if (_equippedDuck == null || bullet.owner == duck || !bullet.isLocal)
            {
                return(false);
            }

            var particleEnd =
                hitPos
                + (bullet.travelDirNormalized * bullet.bulletSpeed
                   * 3)
                + new Vec2(Rando.Float(-5f, 5f), Rando.Float(-5f, 5f));

            for (int i2 = 0; i2 < 3; i2++)
            {
                Level.Add(DotParticle.New(
                              hitPos.x + Rando.Float(-2f, 2f),
                              hitPos.y + Rando.Float(-2f, 2f),
                              () => particleEnd,
                              bullet.color.Add(new Color(
                                                   (byte)Rando.Int(-15, 15),
                                                   (byte)Rando.Int(-15, 15),
                                                   (byte)Rando.Int(-15, 15)
                                                   )),
                              0.2f));
            }
            SFX.Play("scimiSurge", 0.8f, Rando.Float(-0.2f, 0.2f));
            return(true);
        }
Example #2
0
    public float[] kkp;   //流体関連の圧力壁定義点のval

    void Start()
    {
        ucomp           = GameObject.Find("ufo").GetComponent <Ufo>();                   //ufo コンポーネント
        frntcomp        = GameObject.Find("frontpng").GetComponent <Frontstage>();       //コンポーネント
        dtprtcomp       = GetComponent <DotParticle>();                                  //コンポーネント
        stgmngrcomp     = GameObject.Find("StageManager").GetComponent <Stagemanager>(); //コンポーネント
        SE              = GameObject.Find("SE").GetComponent <SoundEffects>();           //コンポーネント
        refer           = GameObject.Find("referobj").GetComponent <Referobj>();         //コンポーネント
        kbp             = new uint[Const.CO.WX * Const.CO.WY];
        kbpori          = new uint[Const.CO.WX * Const.CO.WY];
        kbx             = new uint[Const.CO.WX * Const.CO.WY];
        kby             = new uint[Const.CO.WX * Const.CO.WY];
        kkx             = new float[Const.CO.WX * Const.CO.WY];
        kky             = new float[Const.CO.WX * Const.CO.WY];
        kkp             = new float[Const.CO.WX * Const.CO.WY];
        res             = new int[108];
        bulletsMaterial = new Material(bulletsShader);
        Debug.Log(Mathf.Sqrt(Mathf.Clamp((65536f * 4f) / refer.PARTICLENUM, 0.0f, 1.0f)));
        bulletsMaterial.SetFloat("_Intensity", Mathf.Sqrt(Mathf.Clamp((65536f * 4f) / refer.PARTICLENUM, 0.0f, 1.0f)));
        FindKernelInit();          //
        InitializeComputeBuffer(); //ここで流体関連と粒子等のvram生成
        SetKernels();              //カーネル全部作成&引数セット
        //コマンドバッファ系
        commandb = new CommandBuffer();
        Camera cam = GameObject.Find("Main Camera").GetComponent <Camera>();//コンポーネント

        commandb.name = "gpu instanse";
        commandb.DrawProcedural(cam.cameraToWorldMatrix, bulletsMaterial, 0, MeshTopology.Points, dtprtcomp.RYS.count, 1);
        cam.AddCommandBuffer(CameraEvent.AfterForwardOpaque, commandb);

        GetComponent <LoadWallFromBMP>().stages_speed = 0.0f;
        GetComponent <LoadWallFromBMP>().LoadWallInfo("0");//ここで壁情報を画像データbmpやpngから読み込み壁情報をvramに転送
        cnt  = 0;
        extf = new Vector2(0.0f, 0.0f);
    }
Example #3
0
    // Use this for initialization
    void Start()
    {
        ucomp        = GameObject.Find("ufo").GetComponent <Ufo>();               //ufo コンポーネント
        frntcomp     = GameObject.Find("frontpng").GetComponent <Frontstage>();   //コンポーネント
        bckcomp      = GameObject.Find("backpng").GetComponent <backstage>();     //コンポーネント
        dtprtcomp    = GameObject.Find("nabie").GetComponent <DotParticle>();     //コンポーネント
        ldwllinfcomp = GameObject.Find("nabie").GetComponent <LoadWallFromBMP>(); //コンポーネント
        mnybllts     = GameObject.Find("nabie").GetComponent <MenyBullets>();     //コンポーネント
        SS           = GameObject.Find("StageSound").GetComponent <StageSound>(); //コンポーネント
        SE           = GameObject.Find("SE").GetComponent <SoundEffects>();       //コンポーネント

        //nowstage = 0;//今遊んでるステージ
        nowstage         = GameObject.Find("referobj").GetComponent <Referobj>().nowstage; //シーン切り替えで引き継ぐ変数の受け渡し
        veryfaststageFlg = 1;
        stage_clear_flg  = 0;                                                              //クリア時にのみ1になる
        stage_score      = 0;
        keyflg           = 0;                                                              //キー操作を受け付けるかどうか、1受け付ける、0受け付けない。受け付けないときはufoの座標系さんもとまる
        fadeinflg        = 0;                                                              //フェードインカウンター、開始が0で毎フレーム1増えていく。fade in後操作をしばらく受け付けない
        //difficulty = 0;//0はイージー、1がノーマル、2がハード
        difficulty    = GameObject.Find("referobj").GetComponent <Referobj>().difficulty;  //シーン切り替えで引き継ぐ変数の受け渡し
        stagetime     = 0.0f;
        fadeoutObjflg = 0;

        //ゴール系
        glcomp     = new GoalWhite[4];                      //ゴール設定数最大4
        goalObj    = new GameObject[4];                     //ゴール設定数最大4
        goalnum    = 1;                                     //最初のステージだけここからインスタンス化
        goalObj[0] = Instantiate(goalprefab, new Vector3(1.0f * (96 - Const.CO.WX / 2) / (Const.CO.WY / 2) * 5.0f, 1.0f * (Const.CO.WY - 1 - 72 - Const.CO.WY / 2) / (Const.CO.WY / 2) * 5.0f, -0.02f), Quaternion.identity);
        glcomp[0]  = goalObj[0].GetComponent <GoalWhite>(); //ゴール0のスクリプトデータ取得

        //レアアース系
        rareenum = 0;
        rareeObj = new GameObject[6];//ゴール設定数最大6

        //浮遊obj系
        fobjnum = 0;
        objObj  = new GameObject[3];//浮遊obj設定数最大3
        mvocomp = new Moveobj[3];

        //最初のステージだけはここからインスタンス化、ステージ開始時のフェードイン
        Instantiate(startfab, new Vector3(0.0f, 0.0f, -0.5f), Quaternion.identity);
        //最初のステージだけはここからインスタンス化、ステージ開始時の文字
        Instantiate(stagenameprefab, new Vector3(1.6f, 0.0f, -0.032f), Quaternion.identity);

        //このスクリプトが最後に実行されるためこれが可能になる
        if (nowstage != 0)
        {
            nowstage--;
            stage_score = GameObject.Find("referobj").GetComponent <Referobj>().stage_score;//シーン切り替えで引き継ぐ変数の受け渡し
            stageclear();
        }
    }
Example #4
0
    //RYS側からみたload。画像のうち255,0,255のところが粒子発生点になるのでそれを登録
    public void LoadWallInfo2(string stagename)
    {
        DotParticle dtprtcomp = GetComponent <DotParticle>(); //コンポーネント

        dtprtcomp.someofRYS.dataxy_len = 0;                   //何度もloadwallするためこれは毎回リセット必要
        Loadpngs loadpngs = GetComponent <Loadpngs>();        // コンポーネント

        //壁xと速度を画像から取得
        int[,] tmpbmp;
        tmpbmp = loadpngs.LoadBmp(Application.dataPath + "\\stage\\" + stagename + "\\kabew.bmp");
        int ginfo_g;

        for (int y = 0; y < Const.CO.WY; y++)
        {
            for (int x = 0; x < Const.CO.WX; x++)
            {
                ginfo_g = (tmpbmp[x, y] / 256) % 256;
                if (ginfo_g < 128)
                {                                                   //色の度合いによって粒子の出る割合が異なる。見た目をわかりやすくするためにg=128を0として色が濃いほどたくさん粒子がでる仕様
                    dtprtcomp.someofRYS.Inset(x, y, 128 - ginfo_g); //粒子湧出点を定義、あとで変更、追加もできる
                }
            }
        }
    }
Example #5
0
        public override void Update()
        {
            base.Update();

            if (_equippedDuck != null && !destroyed)
            {
                _equippedCollisionOffset = duck.topLeft - position + new Vec2(-1.5f, -1.5f);
                if (duck.offDir == -1)
                {
                    _equippedCollisionOffset.x -= duck.collisionOffset.x;
                }
                _equippedCollisionSize = _equippedDuck.collisionSize + new Vec2(3, 3);
            }
            else
            {
                _equippedCollisionOffset = baseCollisionOffset - new Vec2(1, 1);
                _equippedCollisionSize   = baseCollisionSize + new Vec2(2, 2);;
            }

            if (_equippedDuck != null)
            {
                var rect = _equippedDuck.rectangle;
                foreach (SmallFire item in Level.current.things[typeof(SmallFire)])
                {
                    if (item.stick == _equippedDuck || item.stick == _equippedDuck.holdObject)
                    {
                        item.stick = null;
                    }
                }

                _equippedDuck.burnt     = 0;
                _equippedDuck.onFire    = false;
                _equippedDuck.flammable = 0;
                if (_equippedDuck.holdObject != null)
                {
                    _equippedDuck.holdObject.heat = 0;
                }

                var equippedDuckFeather = _equippedDuck.persona.featherSprite.texture;
                var equppedDuckColor    = _equippedDuck.persona.colorUsable;
                foreach (var feather in Level.CheckCircleAll <Feather>(_equippedDuck.position, 50))
                {
                    var spriteMap = (SpriteMap)feather_Field.GetValue(feather);
                    if (spriteMap.texture == equippedDuckFeather)
                    {
                        var particleEnd = feather.position + (-feather.velocity * 15);

                        for (int i2 = 0; i2 < 3; i2++)
                        {
                            Level.Add(DotParticle.New(
                                          feather.x,
                                          feather.y,
                                          () => particleEnd,
                                          HSL.RandomRGB(),
                                          0.2f));
                        }
                        Level.Remove(feather);
                    }
                }
            }

            willHeat           = false;
            heat               = 0;
            _onFire            = false;
            _equippedThickness = float.MaxValue;
        }