static public void AddScore(int num)
    {
        // Find the ScoreGT Text field only once.
        if (SCORE_GT == null)
        {
            GameObject go = GameObject.Find("ScoreGT");
            if (go != null)
            {
                SCORE_GT = go.GetComponent <UnityEngine.UI.Text>();
            }
            else
            {
                Debug.LogError("AsteraX:AddScore() - Could not find a GameObject named ScoreGT.");
                return;
            }
            SCORE = 0;
        }
        // SCORE holds the definitive score for the game.
        SCORE += num;

        if (!GOT_HIGH_SCORE && SaveGameManager.CheckHighScore(SCORE))
        {
            // We just got the high score
            GOT_HIGH_SCORE = true;
            // Announce it using the AchievementPopUp
            AchievementPopUp.ShowPopUp("High Score!", "You've achieved a new high score.");
        }

        // Show the score on screen. For info on numeric formatting like "N0", see:
        //  https://docs.microsoft.com/en-us/dotnet/standard/base-types/standard-numeric-format-strings
        SCORE_GT.text = SCORE.ToString("N0");

        AchievementManager.AchievementStep(Achievement.eStepType.scoreAttained, SCORE);
    }
    static public void AddScore(int num)
    {
        // Find the ScoreGT Text field only once.
        if (SCORE_GT == null)
        {
            GameObject go = GameObject.Find("ScoreGT");
            if (go != null)
            {
                SCORE_GT = go.GetComponent <UnityEngine.UI.Text>();
            }
            else
            {
                Debug.LogError("AsteraX:AddScore() - Could not find a GameObject named ScoreGT.");
                return;
            }
            SCORE = 0;
        }
        // SCORE holds the definitive score for the game.
        SCORE += num;

        // Show the score on screen. For info on numeric formatting like "N0", see:
        //  https://docs.microsoft.com/en-us/dotnet/standard/base-types/standard-numeric-format-strings
        SCORE_GT.text = SCORE.ToString("N0");

        AchievementManager.AchievementStep(Achievement.eStepType.scoreAttained, SCORE);
    }
    static public void AddCash(int num)
    {
        // Find the ScoreGT Text field only once.
        if (CASH_GT == null)
        {
            GameObject go = GameObject.Find("CashGT");
            if (go != null)
            {
                CASH_GT = go.GetComponent <Text>();
            }
            else
            {
                Debug.LogError("Warpaid:AddCash() - Could not find a GameObject named CashGT.");
                return;
            }
            CASH = 0;
        }
        // CASH holds the definitive cash for the player.
        CASH += num;

        CASH_GT.text = "$" + CASH.ToString().PadLeft(S.paddingCash).Replace(' ', '0');

        // Notify the AchievementManager that this has happened
        AchievementManager.AchievementStep(Achievement.eStepType.moneyCollected, CASH);
    }
 void OnTriggerEnter(Collider coll)
 {
     if (!coll.CompareTag("Enemy"))
     {
         return;
     }
     Destroy(gameObject);
     AchievementManager.AchievementStep(Achievement.eStepType.destroyEnemy, 1);
 }
Beispiel #5
0
    public void OnCollisionEnter(Collision coll)
    {
        // If this is the child of another Asteroid, pass this collision up the chain
        if (parentIsAsteroid)
        {
            parentAsteroid.OnCollisionEnter(coll);
            return;
        }

        if (immune)
        {
            return;
        }

        GameObject otherGO = coll.gameObject;

        if (otherGO.tag == "Bullet" || otherGO.transform.root.gameObject.tag == "Player")
        {
            if (otherGO.tag == "Bullet")
            {
                Destroy(otherGO);
                AsteraX.AddScore(AsteraX.AsteroidsSO.pointsForAsteroidSize[size]);

                AchievementManager.AchievementStep(Achievement.eStepType.hitAsteroid, 1);

                Bullet bul = otherGO.GetComponent <Bullet>();
                if (bul != null)
                {
                    if (bul.bDidWrap)
                    {
                        AchievementManager.AchievementStep(Achievement.eStepType.luckyShot);
                    }
                }
            }

            if (size > 1)
            {
                // Detach the children Asteroids
                Asteroid[] children = GetComponentsInChildren <Asteroid>();
                for (int i = 0; i < children.Length; i++)
                {
                    children[i].immune = true;
                    if (children[i] == this || children[i].transform.parent != transform)
                    {
                        continue;
                    }
                    children[i].transform.SetParent(null, true);
                    children[i].InitAsteroidParent();
                }
            }

            InstantiateParticleSystem();
            Destroy(gameObject);
        }
    }
 static public void AddBullet(Bullet bullet)
 {
     if (BULLETS == null)
     {
         BULLETS = new List <Bullet>();
     }
     if (BULLETS.IndexOf(bullet) == -1)
     {
         BULLETS.Add(bullet);
         AchievementManager.AchievementStep(Achievement.eStepType.bulletFired, 1);
     }
 }
    static public void AddBullet(Bullet bullet)
    {
        if (BULLETS == null)
        {
            BULLETS = new List <Bullet>();
        }
        if (BULLETS.IndexOf(bullet) == -1)
        {
            BULLETS.Add(bullet);

            // Notify the AchievementManager that this has happened
            AchievementManager.AchievementStep(Achievement.eStepType.bulletFired, 1);
        }
    }
    void StartLevel(int levelNum)
    {
#if DEBUG_AsteraX_LogMethods
        Debug.Log("AsteraX:StartLevel(" + levelNum + ")");
#endif
        if (LEVEL_LIST.Count == 0)
        {
            Debug.LogError("AsteraX:StartLevel(" + levelNum + ") - LEVEL_LIST is empty!");
            return;
        }
        if (levelNum >= LEVEL_LIST.Count)
        {
            levelNum = 1; // Just loop the levels for now. In a real game, this would be different.
        }

        GAME_STATE = eGameState.preLevel;
        GAME_LEVEL = levelNum;
        LevelInfo info = LEVEL_LIST[levelNum - 1];

        // Destroy any remaining Asteroids, Bullets, etc. (including particle effects)
        ClearAsteroids();
        ClearBullets();
        foreach (GameObject go in GameObject.FindGameObjectsWithTag("DestroyWithLevelChange"))
        {
            Destroy(go);
        }

        // Set up the asteroidsSO
        asteroidsSO.numSmallerAsteroidsToSpawn = info.numSubAsteroids;

        // Spawn the parent Asteroids, child Asteroids are taken care of by them
        for (int i = 0; i < info.numInitialAsteroids; i++)
        {
            SpawnParentAsteroid(i);
        }

        CustomAnalytics.SendLevelStart(GAME_LEVEL);
        AchievementManager.AchievementStep(Achievement.eStepType.levelUp, levelNum);
    }
Beispiel #9
0
 public void SnafuComplete()
 {
     if (!snafuSystemCompletion)
     {
         if (snafuSystem.S && snafuSystem.N && snafuSystem.A && snafuSystem.F && snafuSystem.U)
         {
             snafuSystemCompletion = true;
             AchievementManager.AchievementStep(Achievement.eStepType.snafuCompleted, 1);
             if (LIFES.Count < 3)
             {
                 AddLife(DropScriptableObject.GetInventoryItem_SM("life").GetComponent <Item>()); // can type heart instead
                 snafuSystem.S         = snafuSystem.N = snafuSystem.A = snafuSystem.F = snafuSystem.U = false;
                 snafuSystemCompletion = false;
                 HUDSystems.UpdateInventory();
             }
             else
             {
                 StartCoroutine(WaitForSnafu());
             }
         }
     }
 }
    static public void AddScore(int num)
    {
        // Find the ScoreGT Text field only once.
        if (SCORE_GT == null)
        {
            GameObject go = GameObject.Find("ScoreGT");
            if (go != null)
            {
                SCORE_GT = go.GetComponent <Text>();
            }
            else
            {
                Debug.LogError("Warpaid:AddScore() - Could not find a GameObject named ScoreGT.");
                return;
            }
            SCORE = 0;
        }
        // SCORE holds the definitive score for the game.
        SCORE += num;

        if (!GOT_HIGH_SCORE)
        {
            // We just got the high score
            GOT_HIGH_SCORE = true;

            // Announce it using the AchievementPopUp
            AchievementPopUp.ShowPopUp("High Score!", "You've achieved a new high score.");

            // save this fact
            SaveGameManager.Save();
        }

        SCORE_GT.text = SCORE.ToString("N0");


        // Notify the AchievementManager that this has happened
        AchievementManager.AchievementStep(Achievement.eStepType.scoreAttained, SCORE);
    }
 public void DirectToReplace()
 {
     AchievementManager.AchievementStep(Achievement.eStepType.directorRoom, 1);
     PlayerShip.DirectToReplace(new PlayerInfo(3, 2, 1.1f, 1f, 1f, 1f, 1f, 1f, true));
 }
 static public void BulletWrapShot()
 {
     AchievementManager.AchievementStep(Achievement.eStepType.luckyShot, 1);
 }