Пример #1
0
    public void Test1()
    {
        Timer loltime = new Timer();

        loltime.SetTimer(5);
        StartCoroutine(loltime.ActionAfterTimer(() => {
            Debug.Log("lol");
        }));
    }
Пример #2
0
    public void BulletMineTrigger(ExplodeObject expObj)
    {
        if (Cannon.CheckSuitability(expObj.objectType, bullet.bulletType))
        {
            if (!explodeTimerActive)
            {
                explodeTimer.SetTimer(explodeTime);
                explodeTimerActive = true;
                StartCoroutine(explodeTimer.ActionAfterTimer(() => {
                    foreach (ExplodeObject obj in bullet.triggeredExplodeObject)
                    {
                        if (obj.gameObject.activeInHierarchy)
                        {
                            if (Cannon.CheckSuitability(obj.objectType, bullet.bulletType))
                            {
                                obj.MakeDamage(bullet.damageHealthParams.damage);
                            }
                        }
                    }

                    string effectPath = "";
                    if (isShutterMine)
                    {
                        effectPath = "Prefabs/Effects/bullet2ExplodeShatter";
                    }
                    else
                    {
                        effectPath = "Prefabs/Effects/bullet2Explode";
                    }
                    Vector3 bulletPosition       = bullet.transform.position;
                    GameObject effectObj         = ObjectsPool.PullObject(effectPath);
                    effectObj.transform.position = bulletPosition;
                    Effect effect   = effectObj.GetComponent <Effect> ();
                    effect.poolPath = effectPath;
                    effect.main.Play();
                    effect.DestoyOverTime(effect.main.main.duration);

                    if (isShutterMine)
                    {
                        string shatterPath = "Prefabs/Bullets/bullet2ShatterPart";
                        for (int i = 0; i < shattersCount; i++)
                        {
                            GameObject shatter = ObjectsPool.PullObject(shatterPath);
                            //Debug.Log(bullet.transform.position);
                            shatter.transform.position = bulletPosition;
                            Bullet sbullet             = shatter.GetComponent <Bullet> ();
                            sbullet.poolPath           = shatterPath;
                            sbullet.BulletAwake();
                            sbullet.bulletType = bullet.bulletType;
                        }
                    }

                    ObjectsPool.PushObject(bullet.poolPath, this.gameObject);
                }));
            }
        }
    }
Пример #3
0
    public void DestoyOverTime(float time)
    {
        Timer lifeTimer = new Timer();

        lifeTimer.SetTimer(time);
        StartCoroutine(lifeTimer.ActionAfterTimer(() => {
            ObjectsPool.PushObject(poolPath, this.gameObject);
        }));
    }
Пример #4
0
    void Awake()
    {
        interfaceSt = this;
        Timer clickShieldTimer = new Timer();

        clickShieldTimer.SetTimer(1.5f);
        StartCoroutine(clickShieldTimer.ActionAfterTimer(() => {
            clickShield.SetActive(false);
        }));
    }
Пример #5
0
 public void StartRecoverySpawnTimer(float recoveryBoxPartTime)
 {
     recoveryBoxGateTimer.SetTimer(recoveryBoxPartTime);
     StartCoroutine(recoveryBoxGateTimer.ActionAfterTimer(() => {
         if (timerActive)
         {
             StartRecoverySpawnTimer(recoveryBoxPartTime);
             ShipsController.instance.SpawnAbilityBox(1);
         }
     }));
 }
Пример #6
0
 public void StartSpawnCannonBoxTimer(float cannonBoxPartTime)
 {
     cannonBoxTimer.SetTimer(cannonBoxPartTime);
     StartCoroutine(cannonBoxTimer.ActionAfterTimer(() => {
         if (timerActive)
         {
             StartSpawnCannonBoxTimer(cannonBoxPartTime);
             ShipsController.instance.SpawnRandomCannonBox();
         }
     }));
 }
Пример #7
0
    void SetPhase2()
    {
        SpawnGroup();
        currentPhase = 2;
        Timer startMovingTimer = new Timer();

        startMovingTimer.SetTimer(standTime + shipPath0Time);
        StartCoroutine(startMovingTimer.ActionAfterTimer(() => {
            SetPhase0();
        }));
    }
Пример #8
0
    public void StartEffect()
    {
        effect.Play();
        Timer effectTimer = new Timer();

        effectTimer.SetTimer(effect.clip.length);
        StartCoroutine(effectTimer.ActionAfterTimer(() => {
            effect.Stop();
            ObjectsPool.PushObject(poolPath, this.gameObject);
        }));
    }
Пример #9
0
 public void BulletBallTrigger(ExplodeObject expObject)
 {
     if (bulletBallDamageTimer.TimeIsOver())
     {
         //bullet.ClearColliders();
         if (expObject.objectType == bullet.bulletType || expObject.objectType == Cannon.allBullet)
         {
             expObject.MakeDamage(bullet.damageHealthParams.damage);
         }
         bulletBallDamageTimer.SetTimer(bullet.damageHealthParams.damageTickTime);
         StartCoroutine(bulletBallDamageTimer.ActionAfterTimer(() => {
             if (bullet.gameObject.activeInHierarchy)
             {
                 bullet.ClearColliders();
             }
         }));
     }
 }
Пример #10
0
    void SetDead()
    {
        if (LevelController.instance.levelActive)
        {
            LevelController.instance.levelActive = false;
            isDead = true;
            ShipSpawner.instance.StopSpawn();
            Timer explodeTimer = new Timer();
            loseExplode.gameObject.SetActive(true);
            loseExplode.Play();
            AudioController.instance.loseExplode.Play();
            explodeTimer.SetTimer(loseExplode.main.duration);
            StartCoroutine(explodeTimer.ActionAfterTimer(() => {
                loseExplode.gameObject.SetActive(false);
                Interface.interfaceSt.OpenLoseWindow();

                /*foreach (ExplodeObject obj in ShipsController.instance.explodeObjects) {
                 *      obj.DefaultDestroy ();
                 * }
                 * ShipsController.instance.explodeObjects.Clear ();*/
                Dictionary <int, ExplodeObject> expObjDict = new Dictionary <int, ExplodeObject> ();
                for (int i = 0; i < ShipsController.instance.explodeObjects.Count; i++)
                {
                    expObjDict.Add(i, ShipsController.instance.explodeObjects[i]);
                }
                for (int i = 0; i < expObjDict.Count; i++)
                {
                    expObjDict [i].DefaultDestroy();
                }

                List <Bullet> bulletObjects = new List <Bullet> (FindObjectsOfType <Bullet> ());
                foreach (Bullet bullObj in bulletObjects)
                {
                    ObjectsPool.PushObject(bullObj.poolPath, bullObj.gameObject);
                }
                AudioController.instance.currentSong.Stop();
                //Advertising.TryShowInterstitial ();
            }));
        }
    }
Пример #11
0
 void StartBossTimer(int index, Level timeGateLevel)
 {
     if (timerActive)
     {
         float allTime       = timeGateLevel.time - 5f;
         float spawnTimePart = allTime / (timeGateLevel.bosses.Count);
         bossTimer.SetTimer(spawnTimePart);
         StartCoroutine(bossTimer.ActionAfterTimer(() => {
             if (timerActive)
             {
                 ShipsController.instance.SpawnBoss(LevelController.instance.currentRace, timeGateLevel.bosses [index]);
                 PauseEnable();
                 timerActive = false;
                 LevelTimer.instance.timerActive = false;
             }
             else
             {
                 bossTimer.SetTimer(0);
             }
         }));
     }
 }
Пример #12
0
    void Start()
    {
        instance = this;
        Timer connectTimer = new Timer();

        connectTimer.SetTimer(GameController.connectionTimeout + 0.1f);
        StartCoroutine(connectTimer.ActionAfterTimer(() => {
            if (m_StoreController == null)
            {
                initializeAction = () => {
                    StartCoroutine(GameController.ActionAfterFewFramesCoroutine(3, () => {
                        LevelController.instance.CheckFullVersionGame();
                    }));
                };
                InitializePurchasing();
                //LevelController.instance.CheckFullVersionGame ();
            }
        }));


        StartCoroutine(GameController.ActionAfterFewFramesCoroutine(10, () => {
        }));
    }
Пример #13
0
    public void AddSpawnShipToSpawner(int index, Level timeGateLevel)
    {
        if (timerActive)
        {
            ShipSpawner.instance.AddSpawnShipSettingById(timeGateLevel.ships [index]);
            if (index != timeGateLevel.ships.Count - 1)
            {
                float allTime       = timeGateLevel.time - timeGateLevel.time * ShipSpawner.allShipBattleTimePercent;
                float spawnTimePart = allTime / (timeGateLevel.ships.Count - 1f);

                shipGateTimer.SetTimer(spawnTimePart);
                StartCoroutine(shipGateTimer.ActionAfterTimer(() => {
                    if (timerActive)
                    {
                        AddSpawnShipToSpawner(index + 1, timeGateLevel);
                    }
                    else
                    {
                        shipGateTimer.SetTimer(0);
                    }
                }));
            }
        }
    }
Пример #14
0
    void SpawnGroup()
    {
        List <SpawnerGroup> groups = new List <SpawnerGroup> ();

        groups.Add(SpawnerController.instance.firstCarrirerBossGroup);
        groups.Add(SpawnerController.instance.secondCarrirerBossGroup);
        groups.Add(SpawnerController.instance.thirdCarrirerBossGroup);
        SpawnerGroup spawnGroup = groups [Random.Range(0, groups.Count)];

        foreach (Spawner spawner in spawnGroup.spawners)
        {
            int  explodeType = Random.Range(0, 3);
            Ship spawnShip   = ShipsController.instance.SpawnShip(ship.explodeObject.raceType, 1, explodeType).GetComponent <Ship>();
            spawnShip.explodeObject.explodeTransform.position = ship.explodeObject.explodeTransform.position;
            spawnShip.explodeObject.DefaultAwake();
            spawnShip.explodeObject.damageHealthParam          = spawnShip.explodeObject.damageHealthParam.Clone();
            spawnShip.explodeObject.damageHealthParam.pathTime = shipPath0Time;
            spawnShip.explodeObject.DefaultAwake();
            spawnShip.movementController.InstantiateStandartPath(spawnShip.explodeObject.explodeTransform.position, spawner.GetRandomPositionInWorld());
            spawnShip.movementController.pathEndActionComplete = false;
            ShipsController.instance.explodeObjects.Add(spawnShip.explodeObject);
            spawnShip.movementController.pathEndAction = () => {
                if (spawnShip.movementController.pathEndActionComplete == false)
                {
                    spawnShip.explodeObject.explodeTransform.rotation = Quaternion.Euler(new Vector3(0, 0, 180));
                    Timer stopTimer = new Timer();
                    stopTimer.SetTimer(standTime);
                    StartCoroutine(stopTimer.ActionAfterTimer(() => {
                        spawnShip.explodeObject.damageHealthParam.pathTime = shipPath1Time;
                        spawnShip.movementController.InstantiateStandartPath(spawnShip.explodeObject.explodeTransform.position, SpawnerController.instance.bottomSpawner.GetRandomPositionInWorld());
                    }));
                }
                spawnShip.movementController.pathEndActionComplete = true;
            };
        }
    }