Example #1
0
    void Update()
    {
        if (!GameStarted)
        {
            return;
        }

        if (PlayerShip == null && Time.time >= playerRespawnTime)
        {
            SpawnPlayer();
        }

        if (ufo == null && Time.time >= nextUfoSpawnTime)
        {
            ufo = Instantiate(UfoPrefab);
            ufo.transform.position = LevelBox.Instance.GetRandomPointOnLeftRightEdge(UfoMinDistanceFromEdge);
            ufo.transform.rotation = Quaternion.Euler(0, 0, ufo.transform.position.x > 0 ? 90 : -90);
            ScheduleNextUfo();
        }

        if (asteroidsList.Count == 0 && Time.time >= nextWaveTime)
        {
            StartWave();
        }
    }
Example #2
0
    void Start()
    {
        alfa_gage   = 0.0f;
        ucomp       = GameObject.Find("ufo").GetComponent <Ufo>();                   //ufo コンポーネント
        stgmngrcomp = GameObject.Find("StageManager").GetComponent <Stagemanager>(); //コンポーネント
        gage_pos    = gameObject.transform.position + new Vector3(0.15f, 0.17f, -0.0001f);
        // プレハブからインスタンスを生成
        for (int i = 0; i < 5; i++)
        {
            GameObject obj = (GameObject)Instantiate(prefab, gage_pos, Quaternion.identity);
            // 作成したオブジェクトを子として登録
            obj.transform.parent = transform;
            obj.GetComponent <Yajirushi>().yajino = i;
        }
        //スコアの8桁
        //スコアプレハブ生成
        scoreobj = new GameObject[8];
        for (int i = 0; i < 8; i++)
        {
            scoreobj[i] = Instantiate(scorefab, new Vector3(Const.CO.SCOREPOSX + 0.2f * i - 0.24f, Const.CO.SCOREPOSY, -0.0303f), Quaternion.identity);
            scoreobj[i].transform.parent = transform;
        }
        //スコアワード
        GameObject obj_scoreword = Instantiate(prefab_scoreword, new Vector3(-3.76f, -4.12f, -0.0303f), Quaternion.identity);

        obj_scoreword.transform.parent = transform;// 作成したオブジェクトを子として登録
    }
Example #3
0
 void Start()
 {
     refObj0          = GameObject.Find("TIMEGUI0");
     tmg0             = refObj0.GetComponent <TIMEGUI0>();                             //コンポーネント
     refObj1          = GameObject.Find("TIMEGUI1");
     tmg1             = refObj1.GetComponent <TIMEGUI1>();                             //コンポーネント
     refObj3          = GameObject.Find("TIMEGUI3");
     tmg3             = refObj3.GetComponent <TIMEGUI3>();                             //コンポーネント
     refObj4          = GameObject.Find("TIMEGUI4");
     tmg4             = refObj4.GetComponent <TIMEGUI4>();                             //コンポーネント
     refObj6          = GameObject.Find("TIMEGUI6");
     tmg6             = refObj6.GetComponent <TIMEGUI6>();                             //コンポーネント
     refObj7          = GameObject.Find("TIMEGUI7");
     tmg7             = refObj7.GetComponent <TIMEGUI7>();                             //コンポーネント
     refObjf0         = GameObject.Find("FPS0");
     fps0             = refObjf0.GetComponent <FPS0>();                                //コンポーネント
     refObjf1         = GameObject.Find("FPS1");
     fps1             = refObjf1.GetComponent <FPS1>();                                //コンポーネント
     ucomp            = GameObject.Find("ufo").GetComponent <Ufo>();                   //ufo コンポーネント
     stgmngrcomp      = GameObject.Find("StageManager").GetComponent <Stagemanager>(); //コンポーネント
     alfa_time        = 1.0f;
     alfa_fps         = 1.0f;
     alfa_time_pa     = 0.0f;
     alfa_fps_pa      = 0.0f;
     cnt              = 0;
     gage_time_sprite = GameObject.Find("gage_time").GetComponent <SpriteRenderer>();
 }
        public static Vector GetHeadToDraw(this Ufo ufo)
        {
            var centerToDraw = ufo.GetCenterToDraw();

            return(new Vector(centerToDraw.X + ufo.Body.Ry,
                              centerToDraw.Y - ufo.Body.Ry * 0.7f));
        }
Example #5
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 #6
0
        public void MoveTest()
        {
            IShip mockSip   = new MockShip();
            Ufo   testedUfo = new Ufo(new CoupleDouble(5, 5), new CoupleDouble(1, 1), new CoupleDouble(1, 1), mockSip);

            mockSip.Pos = new CoupleDouble(0, 0);

            for (int i = 4; i >= 0; --i)
            {
                testedUfo.ChengeState(new CoupleDouble(100, 100));

                Assert.AreEqual(new CoupleDouble(i, i), testedUfo.Pos);
            }

            testedUfo.Pos = new CoupleDouble(5, 5);
            mockSip.Pos   = new CoupleDouble(5, 0);

            for (int i = 4; i <= 0; i++)
            {
                testedUfo.ChengeState(new CoupleDouble(100, 100));

                Assert.AreEqual(new CoupleDouble(5, i), testedUfo.Pos);
            }

            testedUfo.Pos = new CoupleDouble(5, 5);
            mockSip.Pos   = new CoupleDouble(12, 0);

            for (int i = 6; i <= 10; i++)
            {
                testedUfo.ChengeState(new CoupleDouble(100, 100));

                Assert.AreEqual(new CoupleDouble(i, 10 - i), testedUfo.Pos);
            }
        }
Example #7
0
    //void InstantiateInRow(int row, int count, LivingEntity entity, bool fromLeft)
    //{
    //    if (count > gridXCount) return;

    //    ufos = new Ufo[count];

    //    for (int x = gridXCount - 1, i = 0; x > gridXCount - count; x--, i++)
    //    {
    //        Ufo lE = ufos[i] = (Ufo)Instantiate(entity);
    //        entity.transform.position = tiles[row][x].transform.position;
    //        tiles[row][x].isTaken = true;
    //        lE.gm = this;
    //        lE.currentTile = tiles[row][x];
    //        lE.SetNextTile();
    //        lE.gameObject.name = $"ufo {i} {x}/{row}";
    //    }
    //}

    void InstantiateUfoRow(int row, int startTile, int count, LivingEntity entity, Direction direction)
    {
        int endTile = startTile + count;

        if (endTile > gridXCount)
        {
            endTile = gridXCount;
        }

        if (row > gridZCount)
        {
            row = gridZCount;
        }

        ufos = new Ufo[count];


        for (int x = startTile, i = 0; x < endTile; x++, i++)
        {
            Ufo ufo = ufos[i] = (Ufo)Instantiate(entity);
            ufo.transform.position = tiles[row][x].transform.position;
            ufo.name                = $"ufo {x} {row}/{x}";
            ufo.currentTile         = tiles[row][x];
            ufo.currentTile.isTaken = true;
            ufo.gm                = this;
            ufo.direction         = direction;
            ufo.state             = EnemyState.atPosition;
            ufo.enemyBulletPooler = enemyBulletPooler;
        }
    }
Example #8
0
        public void BulletInteractionTest()
        {
            //organization
            Ufo       firstUfo    = new Ufo(new CoupleDouble(1, 1), new CoupleDouble(1, 1), new CoupleDouble(1, 1));
            Ufo       secondUfo   = new Ufo(new CoupleDouble(1, 1), new CoupleDouble(1, 1), new CoupleDouble(1, 1));
            AEntity   laserBullet = new LaserBullet(new CoupleDouble(1, 1), new CoupleDouble(1, 1), new CoupleDouble(1, 1));
            GunBullet gunBullet   = new GunBullet(new CoupleDouble(1, 1), new CoupleDouble(1, 1), new CoupleDouble(1, 1));

            List <AEntity> bigAsteroidIntResult = new List <AEntity>();

            bigAsteroidIntResult.Add(new Asteroid(new CoupleDouble(1, 1), new CoupleDouble(1, 1), new CoupleDouble(2, 1), 1));
            bigAsteroidIntResult.Add(new Asteroid(new CoupleDouble(1, 1), new CoupleDouble(1, 1), new CoupleDouble(0, 1), 1));

            //activity
            List <AEntity> laserSmalInteraction = firstUfo.Interaction(laserBullet);
            List <AEntity> gunSmalInteraction   = secondUfo.Interaction(gunBullet);

            //assertion


            Assert.AreEqual(laserSmalInteraction, null);
            Assert.AreEqual(gunSmalInteraction, null);

            Assert.IsTrue(firstUfo.WasKilled);
            Assert.IsTrue(secondUfo.WasKilled);
        }
Example #9
0
        private void Spawn()
        {
            foreach (Asteroid a in partedAsteroids)
            {
                Asteroid a1, a2;
                a1 = SpawnAsteroid(a.Position, (int)a.Radius / 2);
                a2 = SpawnAsteroid(a.Position, (int)a.Radius / 2);
                dictAsteroids.Add(a1.Id, a1);
                dictAsteroids.Add(a2.Id, a2);
            }
            partedAsteroids.Clear();

            if (dictAsteroids.Count <= player.SpawnAsteroidsFactorFunction(dictAsteroids.Count))
            {
                if (rnd.NextDouble() < Constants.Asteroid.spawnChance)
                {
                    Edge     randomEdge  = (Edge)edgeArray.GetValue(rnd.Next(edgeArray.Length));
                    Asteroid newAsteroid = SpawnAsteroid(randomEdge);
                    dictAsteroids.Add(newAsteroid.Id, newAsteroid);
                }
            }

            if (dictUfos.Count <= player.SpawnUfosFactorFunction(dictUfos.Count))
            {
                if (rnd.NextDouble() < Constants.Ufo.spawnChance)
                {
                    Edge randomEdge = (Edge)edgeArray.GetValue(rnd.Next(edgeArray.Length));
                    Ufo  u          = SpawnUfo(randomEdge);
                    dictUfos.Add(u.Id, u);
                }
            }
        }
 public void AttackUfo()
 {
     if (state == GameState.Process)
     {
         ufo.StartTimer(2f);
         Ufo.SetActive(true);
         ufo.SetUfoPosition();
     }
 }
Example #11
0
 public override void InitializeUfo(ref Ufo ufo)
 {
     ufo.Position.X = (float)(Ufo.Random.NextDouble() * (double)(Main.maxTilesX << 4));
     ufo.Position.Y = (float)(Ufo.Random.NextDouble() * 5000.0);
     ufo.Opacity    = 0f;
     ufo.Rotation   = 0f;
     _ticks         = 0;
     _maxTicks      = Ufo.Random.Next(120, 240);
 }
Example #12
0
 // Use this for initialization
 void Start()
 {
     ucomp       = GameObject.Find("ufo").GetComponent <Ufo>();                   //ufo コンポーネント
     stgmngrcomp = GameObject.Find("StageManager").GetComponent <Stagemanager>(); //コンポーネント
     SE          = GameObject.Find("SE").GetComponent <SoundEffects>();           //コンポーネント
     objpos      = transform.position;
     objpos.x    = objpos.x * Const.CO.WY * 0.1f + 0.5f * Const.CO.WX;
     objpos.y    = -(objpos.y * Const.CO.WY * 0.1f - 0.5f * Const.CO.WY);
 }
Example #13
0
    private void spawnUFO()
    {
        float      yval    = rdHeight;
        Vector3    spawnPt = new Vector3(-spawnPtPad - (rdWidth / 2), yval, 0);
        GameObject go      = new GameObject();

        go.name = "UFO";
        go.transform.position = spawnPt;
        ufo = go.AddComponent <Ufo>();
        ufo.init(this, false);
    }
 public void DeadUfo(int count)
 {
     UpdateScore(count);
     ufo.ResetObject();
     Ufo.SetActive(false);
     ufo.isDead = true;
     if (state == GameState.Process)
     {
         StartTimer(Random.Range(gameManager.MinAppearanceUFO, gameManager.MaxAppearanceUFO));
     }
 }
Example #15
0
    // Use this for initialization
    void Start()
    {
        walker       = FindObjectOfType <Walker>();
        myCam        = FindObjectOfType <CameraFollow> ();
        ufo          = FindObjectOfType <Ufo> ();
        ufo_unmanned = GameObject.Find("shipUnmanned");

        walker.transform.position = spawnPoint.position;
        ufo.gameObject.SetActive(false);
        onShip = false;
    }
Example #16
0
 public override bool Update(ref Ufo ufo)
 {
     if (this._ticks < 10)
     {
         ufo.Opacity += 0.1f;
     }
     else if (this._ticks > this._maxTicks - 10)
     {
         ufo.Opacity -= 0.1f;
     }
     ref Vector2 position = ref ufo.Position;
Example #17
0
        private void DrawUfo(Ufo ufo, Graphics g)
        {
            var centerToDraw = ufo.GetCenterToDraw();
            var headToDraw   = ufo.GetHeadToDraw();

            g.DrawEllipse(Pens.DarkSeaGreen, headToDraw.X, headToDraw.Y,
                          ufo.Body.Ry * 2, ufo.Body.Ry * 2);

            g.DrawEllipse(Pens.DeepSkyBlue, centerToDraw.X, centerToDraw.Y,
                          ufo.Body.Rx * 2, ufo.Body.Ry * 2);
        }
Example #18
0
 //緑のやつ
 void Start()
 {
     //Texture2DからSpriteを作成//バックのやや黒いやつ
     sprite = Sprite.Create(
         texture: tex,
         rect: new Rect(0, 0, tex.width, tex.height),
         pivot: new Vector2(0.0f, 0.0f)
         );
     GetComponent <SpriteRenderer>().sprite = sprite;
     ucomp = GameObject.Find("ufo").GetComponent <Ufo>();//ufo コンポーネント
     GetComponent <SpriteRenderer>().material.SetVector("_Intensity", new Color(0.2f, 1.0f, 0.1f, 1.0f));
 }
Example #19
0
    // Use this for initialization


    public void Start()
    {
        refObjUfo      = GameObject.Find("ufo");
        ucomp          = refObjUfo.GetComponent <Ufo>();                                //ufo コンポーネント
        stgmngrcomp    = GameObject.Find("StageManager").GetComponent <Stagemanager>(); //コンポーネント
        SE             = GameObject.Find("SE").GetComponent <SoundEffects>();           //コンポーネント
        cnt            = 0;
        goalflg        = Const.CO.GOALWAIT;
        scoreprefabflg = 0;
        alfa           = 1.0f;
        GetComponent <SpriteRenderer>().material.SetVector("_Intensity", new Color(1.0f * alfa, 0.7f * alfa, 0.7f * alfa, 1.0f));
    }
Example #20
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 #21
0
    /// <summary>
    /// создаём объект на одной из 4-х сторон экрана, где 1-лево, 2-верх, 3-низ, 4-право
    /// затем сетим нужные данные в зависимости от того создали астероид или тарелку
    /// </summary>
    private void Spawn()
    {
        Vector3 startPos;
        Vector3 endPos;

        switch (Random.Range(1, 4))
        {
        case 1:
            startPos = new Vector3(-_stats.width, Random.Range(-_stats.height, _stats.height), 1);
            endPos   = new Vector3(_stats.width, Random.Range(-_stats.height, _stats.height), 1);
            break;

        case 2:
            startPos = new Vector3(Random.Range(-_stats.width, _stats.width), -_stats.height, 1);
            endPos   = new Vector3(Random.Range(-_stats.width, _stats.width), _stats.height, 1);
            break;

        case 3:
            startPos = new Vector3(_stats.width, Random.Range(-_stats.height, _stats.height), 1);
            endPos   = new Vector3(-_stats.width, Random.Range(-_stats.height, _stats.height), 1);
            break;

        default:
            startPos = new Vector3(Random.Range(-_stats.width, _stats.width), _stats.height, 1);
            endPos   = new Vector3(Random.Range(-_stats.width, _stats.width), -_stats.height, 1);
            break;
        }
        Vector2 direction = endPos - startPos;
        float   angle     = Mathf.Atan2(direction.x, direction.y) * Mathf.Rad2Deg;

        if (SpawnUfo())
        {
            _obj = PoolManager.Get(_Ufo);
            Ufo component = _obj.GetComponent <Ufo>();
            _obj.transform.position = startPos;
            _obj.transform.rotation = Quaternion.Euler(0, 0, -angle);
            component.target        = _targetForUfo;
            component.Shot();
        }
        else
        {
            _obj = PoolManager.Get(_Asteroid);
        }
        _obj.transform.position = startPos;
        _obj.transform.rotation = Quaternion.Euler(0, 0, -angle);
        Enemy enemy = _obj.GetComponent <Enemy>();

        enemy.gameController = _gameController;
        enemy.speed          = GetSpeed();
        enemy.Move();
        StartCoroutine(SpawnDelay());
    }
Example #22
0
    static void Main()
    {
        Console.WriteLine("***** Multifile Assembly Client *****");
        Helicopter h = new Helicopter();

        h.TakeOff();

        // This will load the *.netmodule on demand.
        Ufo u = new Ufo();

        u.AbductHuman();
        Console.ReadLine();
    }
Example #23
0
        public static void Main(string[] args)
        {
            AirPlane.Flight();
            Helicopter.Flight();
            Ufo.Flight();

            FileStream        fs = File.Open("../../Key.snk", FileMode.Open);
            StrongNameKeyPair k  = new StrongNameKeyPair(fs);

            Console.WriteLine($"\nPublic key:\n{BitConverter.ToString(k.PublicKey)}");
            fs.Close();

            Console.ReadKey();
        }
Example #24
0
    private IEnumerator UfoGenerator(float cooldownTime)
    {
        yield return(new WaitForSeconds(cooldownTime));

        while (true)
        {
            Ufo go = Instantiate(_ufoPrototype,
                                 _gameCamera.ScreenToWorldPoint(new Vector3(0.0f,
                                                                            Random.Range(0.0f, _gameCamera.scaledPixelHeight),
                                                                            -_gameCamera.transform.position.z)),
                                 Quaternion.identity);

            yield return(new WaitForSeconds(cooldownTime));
        }
    }
Example #25
0
        public void EnamyInteractionTest()
        {
            //organization
            Ufo      testedUfo    = new Ufo(new CoupleDouble(1, 1), new CoupleDouble(1, 1), new CoupleDouble(1, 1));
            Asteroid someAsteroid = new Asteroid(new CoupleDouble(1, 1), new CoupleDouble(1, 1), new CoupleDouble(1, 1));
            Ufo      someUfo      = new Ufo(new CoupleDouble(1, 1), new CoupleDouble(1, 1), new CoupleDouble(1, 1));

            //activity
            List <AEntity> asteroidInteraction = testedUfo.Interaction(someAsteroid);
            List <AEntity> ufoInteraction      = testedUfo.Interaction(someUfo);

            //assertion
            Assert.AreEqual(asteroidInteraction, null);
            Assert.AreEqual(ufoInteraction, null);
        }
Example #26
0
        public void AddNbEnemiesToLine(int nbEnemies, EnemyTag enemyTag, double y)
        {
            for (int i = 0; i < nbEnemies; i++)
            {
                switch (enemyTag)//Permet d'integrer un type specifique d'ennemis
                {
                case EnemyTag.ALIEN:
                    Alien alien1 = new Alien();
                    AddEnemy(alien1, i, y);
                    break;

                case EnemyTag.UFO:
                    Ufo alien2 = new Ufo();
                    AddEnemy(alien2, i, y);
                    break;

                case EnemyTag.SQUID1:
                    SquidOne alien3 = new SquidOne();
                    AddEnemy(alien3, i, y);
                    break;

                case EnemyTag.SQUID2:
                    SquidTwo alien4 = new SquidTwo();
                    AddEnemy(alien4, i, y);
                    break;

                case EnemyTag.SQUARE:
                    SquareEnemy alien5 = new SquareEnemy();
                    AddEnemy(alien5, i, y);
                    break;

                case EnemyTag.ARMS1:
                    ArmsEnemyOne alien6 = new ArmsEnemyOne();
                    AddEnemy(alien6, i, y);
                    break;

                case EnemyTag.ARMS2:
                    ArmsEnemyTwo alien7 = new ArmsEnemyTwo();
                    AddEnemy(alien7, i, y);
                    break;

                default:
                    TelyEnemy alien8 = new TelyEnemy();
                    AddEnemy(alien8, i, y);
                    break;
                }
            }
        }
    public void Init()
    {
        gameManager  = CoreTools.GetManager <GameManager>();
        pool         = CoreTools.GetManager <RegulatoryPools>();
        timerManager = CoreTools.GetManager <TimerManager>();
        inputManager = CoreTools.GetManager <InputManager>();

        FindCamera();
        DefiningScreenBoundaries();
        AddEventSystem();
        CreatePools();

        state = GameState.Start;

        gameCanvas = GameObject.Instantiate(gameManager.GameCanvasPrefab);
        gameUi     = gameCanvas.GetComponent <GameUI>();
        gameUi.Init();
        gameCanvas.SetActive(false);

        lobbyCanvas = GameObject.Instantiate(gameManager.LobbyCanvasPrefab);
        lobbyMenu   = lobbyCanvas.GetComponent <LobbyMenu>();
        lobbyMenu.Init();
        lobbyCanvas.SetActive(false);

        SetInput(inputManager.CurrentType);
        inputManager.GetInput().SetActive(false);

        gameManager.sceneRightEdge  = sceneRightEdge;
        gameManager.sceneLeftEdge   = sceneLeftEdge;
        gameManager.sceneTopEdge    = sceneTopEdge;
        gameManager.sceneBottomEdge = sceneBottomEdge;
        gameManager.sceneWidth      = sceneWidth;
        gameManager.sceneHeight     = sceneHeight;

        startAsteroidCount = gameManager.StartAsteroidsCount;

        player = GameObject.Instantiate(gameManager.PlayerPrefab);
        ship   = player.GetComponent <Ship>();
        ship.Init();
        player.SetActive(false);

        Ufo = GameObject.Instantiate(gameManager.UfoPrefab);
        ufo = Ufo.GetComponent <UFO>();
        ufo.Init();
        Ufo.SetActive(false);

        EnteringGameMenu();
    }
Example #28
0
 public override bool Update(ref Ufo ufo)
 {
     if (_ticks < 10)
     {
         ufo.Opacity += 0.1f;
     }
     else if (_ticks > _maxTicks - 10)
     {
         ufo.Opacity -= 0.1f;
     }
     if (_ticks == _maxTicks)
     {
         return(false);
     }
     _ticks++;
     return(true);
 }
Example #29
0
            public override void InitializeUfo(ref Ufo ufo)
            {
                ufo.Position.X = (float)(Ufo.Random.NextDouble() * (double)(Main.maxTilesX << 4));
                ufo.Position.Y = (float)(Ufo.Random.NextDouble() * 5000.0);
                ufo.Opacity    = 0f;
                float  num  = (float)Ufo.Random.NextDouble() * 5f + 10f;
                double num2 = Ufo.Random.NextDouble() * 0.60000002384185791 - 0.30000001192092896;

                ufo.Rotation = (float)num2;
                if (Ufo.Random.Next(2) == 0)
                {
                    num2 += 3.1415927410125732;
                }
                _speed    = new Vector2((float)Math.Cos(num2) * num, (float)Math.Sin(num2) * num);
                _ticks    = 0;
                _maxTicks = Ufo.Random.Next(400, 500);
            }
Example #30
0
        public void EnemyInteractionTest()
        {
            GunBullet firstTestedGunBullet  = new GunBullet(new CoupleDouble(1, 1), new CoupleDouble(1, 1), new CoupleDouble(-1, -1));
            GunBullet secondTestedGunBullet = new GunBullet(new CoupleDouble(2, 2), new CoupleDouble(2, 2), new CoupleDouble(-1, -1));

            Ufo      someUfo      = new Ufo(new CoupleDouble(1, 1), new CoupleDouble(1, 1), new CoupleDouble(-1, -1));
            Asteroid someAsteroid = new Asteroid(new CoupleDouble(2, 2), new CoupleDouble(2, 2), new CoupleDouble(-1, -1));

            List <AEntity> interUfoResult    = firstTestedGunBullet.Interaction(someUfo);
            List <AEntity> interaAsterResult = secondTestedGunBullet.Interaction(someAsteroid);

            Assert.AreEqual(null, interUfoResult);
            Assert.AreEqual(null, interaAsterResult);

            Assert.IsTrue(firstTestedGunBullet.WasKilled);
            Assert.IsTrue(secondTestedGunBullet.WasKilled);
        }
Example #31
0
 public override void InitializeUfo(ref Ufo ufo)
 {
     ufo.Position.X = (float)Ufo.Random.NextDouble() * (Main.maxTilesX << 4);
     ufo.Position.Y = (float)(Ufo.Random.NextDouble() * 5000.0);
     ufo.Opacity = 0.0f;
     float num1 = (float)(Ufo.Random.NextDouble() * 5.0 + 10.0);
     double num2 = Ufo.Random.NextDouble() * 0.600000023841858 - 0.300000011920929;
     ufo.Rotation = (float)num2;
     if (Ufo.Random.Next(2) == 0)
         num2 += 3.14159274101257;
     _speed = new Vector2((float)Math.Cos(num2) * num1, (float)Math.Sin(num2) * num1);
     _ticks = 0;
     _maxTicks = Ufo.Random.Next(400, 500);
 }
Example #32
0
        private void GenerateUfos()
        {
            _maxUfos = (int)(256.0 * (Main.maxTilesX / 4200f));
            _ufos = new Ufo[_maxUfos];
            int num1 = _maxUfos >> 4;
            for (int index = 0; index < num1; ++index)
            {
                double num2 = index / num1;
                _ufos[index] = new Ufo(Main.extraTexture[5], (float)(Main.rand.NextDouble() * 4.0 + 6.59999990463257));
                _ufos[index].GlowTexture = Main.glowMaskTexture[90];
            }

            for (int index = num1; index < this._ufos.Length; ++index)
            {
                double num2 = (index - num1) / (_ufos.Length - num1);
                _ufos[index] = new Ufo(Main.extraTexture[6], (float)(Main.rand.NextDouble() * 5.0 + 1.60000002384186));
                _ufos[index].Scale = 0.5f;
                _ufos[index].GlowTexture = Main.glowMaskTexture[91];
            }
        }
Example #33
0
 public abstract void InitializeUfo(ref Ufo ufo);
Example #34
0
 public abstract bool Update(ref Ufo ufo);
Example #35
0
 public override void InitializeUfo(ref Ufo ufo)
 {
     ufo.Position.X = (float)Ufo.Random.NextDouble() * (float)(Main.maxTilesX << 4);
     ufo.Position.Y = (float)(Ufo.Random.NextDouble() * 5000.0);
     ufo.Opacity = 0.0f;
     ufo.Rotation = 0.0f;
     _ticks = 0;
     _maxTicks = Ufo.Random.Next(120, 240);
 }
Example #36
0
 public override bool Update(ref Ufo ufo)
 {
     if (_ticks < 10)
         ufo.Opacity += 0.1f;
     else if (_ticks > _maxTicks - 10)
         ufo.Opacity -= 0.1f;
     if (_ticks == _maxTicks)
         return false;
     ++_ticks;
     return true;
 }