Beispiel #1
0
 private void Awake()
 {
     if (instance == null)
     {
         instance = this;
         GetPlayersFromInsp();
         GetPadsFromInsp();
         GetRocketsFromInsp();
         GetItemsFromInsp();
         GetPowerupFromInsp();
         GetMoverFromInsp();
         GetZoneFromInsp();
         GetStormFromInsp();
         SetTimers();
         SetUpCamera();
         SetUpText();
         SetUpUI();
         SetTargets();
         EndGameUI.SetActive(false);
         StartCoroutine("FadeAnimation");
         Debug.LogError("Awake");
         fTimeOnScreen = 0.5f;
         // Variables();
     }
     else if (instance != null)
     {
         Destroy(gameObject);
     }
 }
Beispiel #2
0
    void Start()
    {
        cSGM = GameObject.Find("GameManager").GetComponent <CS_Gamemanager>();

        EnemySpawnChance();
        GetSpawnPoints();
        WhatEnemy();
        SpawnEnemies();
    }
Beispiel #3
0
 // Use this for initialization
 void Start()
 {
     manager     = GameObject.Find("GameManager").GetComponent <CS_Gamemanager>();
     gameManager = FindObjectOfType <CS_Gamemanager>();
     Movement    = GameObject.FindGameObjectWithTag("Player").GetComponent <CS_Player_Movment>();
     movement    = GameObject.FindGameObjectWithTag("Player").GetComponent <movment>();
     CS_Notify.Register(this, "BiggerCoins");
     CS_Notify.Register(this, "ShotCoins");
 }
Beispiel #4
0
 public void Update()
 {
     if (m_bActive)
     {
         m_fTimeUntilFire -= Time.deltaTime;
         if (m_fTimeUntilFire <= 0)
         {
             CS_Gamemanager.TriggerPowerup(m_CollidingPlayer);
             Destroy(gameObject);
         }
     }
 }
Beispiel #5
0
    // Use this for initialization
    void Start()
    {
        hSI = GameObject.Find("HighScoreInput").GetComponent <CS_HighScoreInput>();
        gM  = GameObject.Find("GameManager").GetComponent <CS_Gamemanager>();

        foreach (Transform child in this.transform)
        {
            if (child.tag == "Score")
            {
                score.Add(child.GetComponent <Text>());
            }
        }
        for (int i = 0; i < score.Count; i++)
        {
            score[i].text = "" + gM.coins;
        }
    }
Beispiel #6
0
    public void DropHalfItems()
    {
        List <GameObject> filledItems = new List <GameObject>();

        // Get all the filled objects
        for (int i = 0; i < 4; i++)
        {
            if (IsSlotFilled[i])
            {
                filledItems.Add(Slots[i]);
            }
        }

        // Figure how many items to remove
        int amountToRemove = (int)Mathf.Floor(filledItems.Count * 0.5f);

        int[] items = new int[2]; // Stores the id's of the items to be removed

        if (filledItems.Count > 1)
        {
            int iItemCount = Random.Range(0, filledItems.Count - 1);
            Slots[filledItems[iItemCount].GetComponent <CS_PadItem>().fieldItem.ID].GetComponent <MeshRenderer>().enabled = false;
            items[0] = filledItems[iItemCount].GetComponent <CS_PadItem>().fieldItem.ID;
            filledItems.RemoveAt(iItemCount);
            if (amountToRemove > 1)
            {
                int iItem1Count = Random.Range(0, filledItems.Count - 1);
                Slots[filledItems[iItem1Count].GetComponent <CS_PadItem>().fieldItem.ID].GetComponent <MeshRenderer>().enabled = false;
                items[1] = filledItems[iItem1Count].GetComponent <CS_PadItem>().fieldItem.ID;
                filledItems.RemoveAt(iItem1Count);
            }
        }
        for (int i = 0; i < amountToRemove; i++)
        {
            CS_Gamemanager.DropItem(items[i], Slots[items[i]].transform);
            Slots[items[i]].GetComponent <CS_PadItem>().DropSlot();
        }

        for (int i = 0; i < amountToRemove; i++)
        {
            int slot = items[i];
            IsSlotFilled[slot] = false;
        }
    }
Beispiel #7
0
    void Start()
    {
        coins            = GameObject.Find("GameManager").GetComponent <CS_Gamemanager>();
        rend             = this.gameObject.GetComponent <SpriteRenderer>();
        whichDamagePoint = 0;
        CS_Notify.Register(this, "EndGame");
        deathAnimation = GetComponent <Animator>();

        foreach (Transform child in this.transform)
        {
            if (child.tag == "Damage")
            {
                damagePoints.Add(child);
                child.GetComponent <ParticleSystem>().Stop();
            }
        }
        highScoreInput = GameObject.Find("HighScoreInput");
        highScoreInput.SetActive(false);
    }
Beispiel #8
0
 void Start()
 {
     Movement           = GameObject.FindGameObjectWithTag("Player").GetComponent <CS_Player_Movment>();
     movement           = GameObject.FindGameObjectWithTag("Player").GetComponent <movment>();
     checkIfHit         = GameObject.FindGameObjectWithTag("Player").GetComponent <CS_Player>();
     boostEffect        = GameObject.Find("Speed Particle Effect");
     stage              = this.gameObject.GetComponent <CS_Stages>();
     pickUpParticleText = GameObject.Find("Text_ParticleMaterialMaker").GetComponentInChildren <Text>();
     lossParticleText   = GameObject.Find("Text_ParticleMaterialMakerLoss").GetComponentInChildren <Text>();
     scoreCoins         = GameObject.Find("GameManager").GetComponent <CS_Gamemanager>();
     dC             = GameObject.Find("DeathCounter").GetComponent <CS_DeathCounter>();
     Cursor.visible = false;
     boostEffect.gameObject.SetActive(false);
     foreach (Transform child in GameObject.FindGameObjectWithTag("TrueCanvas").transform)
     {
         if (child.tag == "Score")
         {
             score.Add(child.GetComponent <Text>());
         }
     }
 }
Beispiel #9
0
 void Start()
 {
     playerScore = GameObject.Find("GameManager").GetComponent <CS_Gamemanager>();
     playerLife  = GameObject.FindGameObjectWithTag("Player").GetComponent <CS_Player>();
 }
Beispiel #10
0
 void Start()
 {
     player         = GameObject.Find("Player").GetComponent <Transform>();
     gM             = GameObject.Find("GameManager").GetComponent <CS_Gamemanager>();
     deathAnimation = GetComponent <Animator>();
 }