Inheritance: MonoBehaviour
 void OnCollisionEnter(Collision collision)
 {
     Debug.Log(collision.gameObject.name);
     if (collision.gameObject.name == "Bullet(Clone)")
     {
         RedFlash.Flash();
         Destroy(collision.gameObject);
     }
 }
 protected override void Awake()
 {
     base.Awake();
     GameSettings.GoodGuys.Add(transform);
     rb              = GetComponent <Rigidbody>();
     cameraDif       = cam.transform.position.y - rb.transform.position.y;
     initialSpeed    = moveSpeed;
     characterCombat = GetComponent <CharacterCombat>();
     stats           = GetComponent <CharacterStats>();
     GameController.Instance.uiController.UpdatePlayerHealth(stats.maxHealth, stats.maxHealth);
     DontDestroyOnLoad(this.gameObject);
     motor    = GetComponent <PlayerMotor>();
     agent    = GetComponent <NavMeshAgent>();
     redFlash = redFlashHolder.GetComponent <RedFlash>();
 }
Exemple #3
0
    void Start()
    {
        flash = this.GetComponent <RedFlash>();
        shake = this.GetComponent <CameraShake>();
        pics  = this.GetComponent <Pictures>();
        words = this.GetComponent <Words>();
        int numWords = words.getCount();

        int[] check = new int[numWords];
        check.Initialize();
        int rand;

        countCurWord = 0;

        string[] keyArray = words.getKeyArray();

        int    loopCount = 0;     // debug
        string temp      = "";    // debug

        while (answerStack.Count < numWords)
        {
            rand = Random.Range(0, numWords);
            bool flag = true;

            if (check[rand] != 0)
            {
                flag = false;
            }

            if (flag == true)
            {
                answerStack.Push(keyArray[rand]);
                check[rand] = -1;

                temp += "[" + keyArray[rand] + "]";                 // debug
            }

            /*else
             *      Debug.Log ("DENIED!"); //debugging purposes*/

            loopCount++;
        }

        Debug.Log("pre-selection of words done! " + loopCount + " loop throughs.\n" + temp);

        wordCounter.text = countCurWord + " / 10";
        Init();
    }
Exemple #4
0
    void Awake()
    {
        int[] check = new int[46];
        int   randomNumber;
        int   loopCount = 0;

        while (katakanaNumStack.Count < 46)
        {
            randomNumber = Random.Range(0, katakana.Length);
            bool flag = true;

            if (check[randomNumber] != 0)
            {
                flag = false;
            }

            if (flag == true)
            {
                katakanaNumStack.Push(randomNumber);
                //Debug.Log (randomNumber + " selected.");
                check[randomNumber] = -1;
            }

            /*else//debugging purposes
             *      Debug.Log ("DENIED!");*/

            loopCount++;
        }

        Debug.Log("pre-selection of integers done! " + loopCount + " loop throughs.");

        countUsedKatakana = 0;
        inUseRound        = new int[3];
        usedKatakana      = new int[katakana.Length];    // Initializes to number of katakana (will always be 46).
        //Debug.Log ("[GC_Awake] katakana.Length = " + katakana.Length);

        GMAudioSource = gameObject.GetComponent <AudioSource>();

        gameSetup = GameObject.FindObjectOfType(typeof(GameSetup_L02)) as GameSetup_L02;
        lives     = GameObject.FindObjectOfType(typeof(Lives)) as Lives;
        shake     = GameObject.FindObjectOfType(typeof(CameraShake)) as CameraShake;
        flash     = GameObject.FindObjectOfType(typeof(RedFlash)) as RedFlash;

        InstantiateRound();
    }
Exemple #5
0
    void Awake()
    {
        int[] check = new int[46];
        int   randomNumber;
        int   loopCount = 0;

        while (hiraganaNumStack.Count < 46)
        {
            randomNumber = Random.Range(0, hiragana.Length);
            bool flag = true;

            if (check[randomNumber] != 0)
            {
                flag = false;
            }

            if (flag == true)
            {
                hiraganaNumStack.Push(randomNumber);
                //Debug.Log (randomNumber + " selected.");
                check[randomNumber] = -1;
            }

            /*else
             *      Debug.Log ("DENIED!");*/

            loopCount++;
        }

        Debug.Log("pre-selection of integers done! " + loopCount + " loop throughs.");

        countUsedHiragana = 0;
        inUseRound        = new int[3];
        usedHiragana      = new int[hiragana.Length];    // Initializes to number of hiragana (will always be 46).
        //Debug.Log ("[GC_Awake] hiragana.Length = " + hiragana.Length);
        GMAudioSource = gameObject.GetComponent <AudioSource>();

        timer     = Timer.FindObjectOfType(typeof(Timer)) as Timer;
        gameSetup = GameSetup.FindObjectOfType(typeof(GameSetup)) as GameSetup;
        shake     = CameraShake.FindObjectOfType(typeof(CameraShake)) as CameraShake;
        flash     = RedFlash.FindObjectOfType(typeof(RedFlash)) as RedFlash;

        InstantiateRound();
    }