public void destroyObject(){
	
		//print ("destroy - gameObject type = "+gameObject.name);

		//mgrInstance = spawnMgr.GetComponent<spawningManager> () as spawningManager;
		//print (mgrInstance);
		scoreInst = scoreObj.GetComponent<scoreManager> () as scoreManager;
		if (gameObject.name == "targetBoardSmall(Clone)") {
		
			scoreInst.addToScore(1);
			//mgrInstance.countTargetHit();
			//spawnMgr.countTargetHit();
			print ("destroying smalltarget");
		};
		if (gameObject.name == "kitty(Clone)") {

			//scoreInst.addToScore(2);
			//mgrInstance.countKittyHit();
			//spawnMgr.countTargetHit();
			print ("destroying kitty!");
		};


		Destroy (gameObject);
	}
Example #2
0
    // Start is called before the first frame update
    void Start()
    {
        //randomly assigning each enemy a different sprite and associated health level
        rand = Random.Range(0, enemySprites.Length);
        GetComponent <SpriteRenderer>().sprite = enemySprites[rand];
        health = healthValue[rand];

        dexModifier = 0;

        score = GameObject.FindWithTag("score").GetComponent <scoreManager>();
    }
Example #3
0
 void Start()
 {
     if (ScoreManager == null)
     {
         ScoreManager = this;
         DontDestroyOnLoad(this);
     }
     else
     {
         Destroy(gameObject);
     }
 }
 // Start is called before the first frame update
 void Start()
 {
     //get all options for path
     pathPoints = GameObject.Find("TractorPath");
     followThis = pathPoints.GetComponentsInChildren <Transform>();
     //just generate a random spot to move next
     nextMove = RNG();
     //access managers for update on collision
     score  = FindObjectOfType <scoreManager>();
     health = FindObjectOfType <healthManager>();
     sound  = FindObjectOfType <AudioManager>();
 }
    // Start is called before the first frame update
    void Start()
    {
        //find the managers for correct health, score keeping and playing sounds on collision
        score  = FindObjectOfType <scoreManager>();
        health = FindObjectOfType <healthManager>();
        sound  = FindObjectOfType <AudioManager>();

        //give it a random speed
        //gameobjects managed by colliders
        rb          = gameObject.GetComponent <Rigidbody2D>();
        rb.velocity = transform.right * truckSpeed;
    }
 void Awake()
 {
     if (instance)
     {
         Destroy(this.gameObject);
     }
     else
     {
         instance = this;
     }
     UpdateScore();
 }
Example #7
0
    // Réactualisatoin du score / méthode pas terrible car l'instantiation
    // de la classe scoremanager dans les prefabs ennemy obligent a trouver l'objet score text a chaque hit.


    void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }

        else if (instance != this)
        {
            Destroy(gameObject);
        }
    }
Example #8
0
    void Start()
    {
        Error();

        score = GetComponent <scoreManager> ();
        if (!score)
        {
            Debug.LogError("score (scoreManager) is null (gameOver)");
        }

        isGameOver = false;
        isGoMenu   = false;
    }
Example #9
0
    void Start()
    {
        click.Play();

        platformStartPoint = platformGenerator.position;

        playerStartPoint = player.transform.position;

        score = FindObjectOfType <scoreManager>();

        isGameRunning = true;

        mainThemeMusic.Play();
    }
Example #10
0
    // Start is called before the first frame update
    void Start()
    {
        //set initial speed
        speed = 1.0f;
        //get the path
        pathPoints = GameObject.Find("AmbulancePath");
        //get all options for path
        followThis = pathPoints.GetComponentsInChildren <Transform>();

        //access the managers for functionality
        score  = FindObjectOfType <scoreManager>();
        health = FindObjectOfType <healthManager>();
        sound  = FindObjectOfType <AudioManager>();
    }
Example #11
0
    // Start is called before the first frame update



    void Start()
    {
        Enemy              = GetComponent <enemy>();
        player             = GameObject.FindGameObjectWithTag("player").GetComponent <runner>();
        scoreManagerScript = GameObject.FindGameObjectWithTag("player").GetComponent <scoreManager>();

        hp     += player.lvl;
        damage += player.lvl;



        rb     = GetComponent <Rigidbody2D>();
        anim   = GetComponent <Animator>();
        sprite = GetComponent <SpriteRenderer>();
    }
Example #12
0
    // Use this for initialization
    void Start()
    {
        gameObject.GetComponent <BoxCollider2D> ().enabled = false;
        scoreMan = FindObjectOfType <scoreManager>();
        rb       = GetComponent <Rigidbody2D>();
        sr       = GetComponent <SpriteRenderer>();
        elipse.SetActive(false);

        if (gameObject.tag == "squareCustomer")
        {
            velocity = new Vector2(-5f, 0f);
        }
        else
        {
            velocity = new Vector2(5f, 0f);
        }
        timeLeft = Random.Range(0.5f, 2.5f);
    }
Example #13
0
    void Start()
    {
        Time.timeScale = 1;
        Error();

        score = GetComponent <scoreManager> ();
        if (!score)
        {
            Debug.LogError("score (scoreManager) is null (mainMenu)");
        }

        if (score)
        {
            if (reset)
            {
                score.ResetScore();
            }
            StatusHighScore();
        }
    }
Example #14
0
    void Start()
    {
        Error();

        if (map)
        {
            soul  = map.GetComponent <spawnSoul> ();
            score = map.GetComponent <scoreManager> ();

            if (!soul)
            {
                Debug.LogError("soul (map) is null (chapterManager)");
            }
            if (!score)
            {
                Debug.LogError("score (map) is null (chapterManager)");
            }
            else
            {
                if (score.isExplore == 0)
                {
                    TextEnabled(textStart [0]);
                }
                else
                {
                    isExplore = true;
                }
            }
        }

        audioSource = GetComponent <AudioSource> ();
        if (!audioSource)
        {
            Debug.LogError("audioSource (AudioSource) is null (chapterManager)");
        }

        for (int i = 0; i < isSpawnYellowSoul.Length; i++)
        {
            isSpawnYellowSoul [i] = false;
        }
    }
    // Use this for initialization
    void Start()
    {
        if (_manager == null)
        {
            _manager = GameObject.FindGameObjectWithTag("manager");
        }

        if (sm == null)
        {
            sm = _manager.GetComponent <scoreManager>();
        }

        if (con == null)
        {
            con = GameObject.FindGameObjectWithTag("Player").GetComponent <controller>();
        }

        gu           = this.gameObject.transform.parent.gameObject.GetComponent <ghsUtility>();
        ghs          = gu.getData();
        preHS.text   = sm.scoreTXT.text;
        preGOHS.text = sm.scoreTXT.text;

        if (ghs.user_icon != null)
        {
            getUserIcon(ghs.useBlob, ghs.user_icon, userIconPS);
            getUserIcon(ghs.useBlob, ghs.user_icon, userIconGOS);
        }

        if (ghs.name != null)
        {
            userNamePS.text  = ghs.name;
            userNameGOS.text = ghs.name;
        }
        else
        {
            userNamePS.text  = "username";
            userNameGOS.text = "username";
        }

        rewardBtn.enabled = !con.rewarded;
    }
Example #16
0
    // Use this for initialization
    void Start()
    {
        health   = 3;
        lifetime = Screen.height / 10;
        speed    = Screen.height / 4;
        rb       = GetComponent <Rigidbody2D> ();

        if (rb == null)
        {
            gameObject.AddComponent <Rigidbody2D>();
            rb = GetComponent <Rigidbody2D>();
        }

        if (_manager == null)
        {
            _manager = GameObject.FindGameObjectWithTag("manager");
        }

        rb.gravityScale = 0f;
        sc = _manager.GetComponent <scoreManager>();
    }
Example #17
0
    void Awake()
    {
        // Теперь, проверяем существование экземпляра
        if (instance == null)
        {                    // Экземпляр менеджера был найден
            instance = this; // Задаем ссылку на экземпляр объекта
        }
        else if (instance == this)
        {                        // Экземпляр объекта уже существует на сцене
            Destroy(gameObject); // Удаляем объект
        }

        // Теперь нам нужно указать, чтобы объект не уничтожался
        // при переходе на другую сцену игры
        DontDestroyOnLoad(gameObject);


        ballObj           = FindObjectOfType <BallScript>().gameObject;
        ballStartPosition = ballObj.transform.position;
        scoreText         = GameObject.Find("ScoreText").GetComponent <Text>();
    }
    // Use this for initialization
    void Start()
    {
        nRandomFruit = Random.Range(0, 5);

        targetFrameData = Instantiate(targetFrame, new Vector3(parentPos.x + framePos.x, parentPos.y + framePos.y, parentPos.z + framePos.z), Quaternion.identity);       //目標物を囲うものを生成
        targetFrameData.GetComponent <targetCupMove>().moveSpeed = moveSpeed;
        targetFrameData.GetComponent <targetData>().point        = 0;
        targetFrameData.GetComponent <targetData>().type         = nRandomFruit;
        targetFrameData.GetComponent <targetData>().maxObj       = maxObj;
        //targetFrameData.GetComponent<targetData>().objPos = pointPos;
        //targetFrameData.GetComponent<targetData>().objSize = pointSize;
        targetFrameData.GetComponent <targetData>().parentSize = parentSize + frameSize;

        //スコアのターゲット設定
        scoreObj  = GameObject.Find("scoreManager");
        scoreData = scoreObj.GetComponent <scoreManager>();
        scoreData.SetType(nRandomFruit);

        //ターゲット設定
        FruitTag.GetComponent <SpriteRenderer>().sprite = FruitTex[nRandomFruit];                                                                              //テクスチャの設定
        targetData = Instantiate(FruitTag, new Vector3(parentPos.x + targetPos.x, parentPos.y + targetPos.y, parentPos.z + targetPos.z), Quaternion.identity); //ターゲットの生成
        //targetData.GetComponent<targetData>().point = 0;
        //targetData.GetComponent<targetData>().type = nRandomFruit;
        //targetData.GetComponent<targetData>().maxObj = maxObj;
        //targetData.GetComponent<targetData>().parentSize = parentSize + frameSize;
        targetData.GetComponent <targetCupMove>().moveSpeed = moveSpeed;

        //吹き出し設定
        //bubbleMiddleData = Instantiate(bubbleMiddle, new Vector3(parentPos.x + bubblePos.x, parentPos.y + bubblePos.y, parentPos.z + bubblePos.z), Quaternion.identity);       //吹き出し(中央)の生成
        //bubbleMiddleData.GetComponent<bubbleMoveKill>().type = targetData.GetComponent<targetData>().type;
        //bubbleMiddleData.GetComponent<bubbleMoveKill>().type = targetFrameData.GetComponent<targetData>().type;
        //bubbleMiddleData.GetComponent<bubbleMoveKill>().moveSpeed = bubbleSpeed;

        //サイズ設定
        targetFrameData.transform.localScale = new Vector3(parentSize.x * frameSize.x, parentSize.y * frameSize.y, parentSize.z * frameSize.z);
        targetData.transform.localScale      = new Vector3(parentSize.x * targetSize.x, parentSize.y * targetSize.y, parentSize.z * targetSize.z);
        //bubbleMiddleData.transform.localScale = new Vector3(parentSize.x * bubbleSize.x, parentSize.y * bubbleSize.y, parentSize.z * bubbleSize.z);
    }
Example #19
0
    void init()
    {
        game_score = 0;

        if (canvasGroup == null)
        {
            canvasGroup = GetComponent <CanvasGroup>();
        }
        if (score_manager == null)
        {
            score_manager = ScoreManager.gameObject.GetComponent <scoreManager>();
        }

        best_score = score_manager.LoadScore();

        pattern1  = 0.5f; // just random
        pattern2  = 2.4f;
        pattern34 = 5.3f;
        pattern56 = 20;

        pattern_time = 1;
        isgameover   = false;
    }
Example #20
0
 // Start is called before the first frame update
 void Start()
 {
     rb = GetComponent <Rigidbody>();
     sm = scoreManager.GetComponent <scoreManager>();
 }
Example #21
0
 void Start()
 {
     theScoreManager  = FindObjectOfType <scoreManager>();
     collectableSound = GameObject.Find("Collectable sound effect").GetComponent <AudioSource>();
 }
Example #22
0
 private void Awake()
 {
     instance = this;
 }
Example #23
0
 // Use this for initialization
 void Start()
 {
     theScoreManager = FindObjectOfType <scoreManager>();
 }
 void Start()
 {
     sm =  GameObject.FindObjectOfType<scoreManager>().GetComponent<scoreManager>();
     Debug.Log(sm);
 }
Example #25
0
    void Start()
    {
        Error();
        if (map)
        {
            node   = map.GetComponent <tileMap> ();
            score  = map.GetComponent <scoreManager> ();
            spawn  = map.GetComponent <spawnSoul> ();
            status = map.GetComponent <gameOver> ();

            if (!score)
            {
                Debug.LogError("score (map) is null (heroController)");
            }
            if (!status)
            {
                Debug.LogError("status (map) is null (heroController)");
            }
            if (!spawn)
            {
                Debug.LogError("spawn (map) is null (heroController)");
            }
            if (!node)
            {
                Debug.LogError("node (map) is null (heroController)");
            }
            else
            {
                ChangeNode();
            }
        }

        if (teleport)
        {
            isTeleport  = true;
            imgTeleport = teleport.GetComponent <Image> ();
            btnTeleport = teleport.GetComponent <Button> ();

            if (!imgTeleport)
            {
                Debug.LogError("imgTeleport (teleport) is null (heroController)");
            }
            else
            {
                imgTeleport.fillAmount = 0f;
            }
            if (!btnTeleport)
            {
                Debug.LogError("btnTeleport (teleport) is null (heroController)");
            }
            else
            {
                btnTeleport.interactable = false;
            }
        }

        if (explore)
        {
            if (score.isExplore == 1)
            {
                Destroy(explore);
            }
            else
            {
                imgExplore = explore.GetComponent <Image> ();
                if (!imgExplore)
                {
                    Debug.LogError("imgExplore (explore) is null (heroController)");
                }
                else
                {
                    imgExplore.fillAmount = 1f;
                }
            }
        }

        if (scoreDisplay)
        {
            scoreDisplay.text = "0";
        }

        anim        = GetComponent <Animator> ();
        audioSource = GetComponent <AudioSource> ();
        if (!anim)
        {
            Debug.LogError("anim (Animator) is null (heroController)");
        }
        if (!audioSource)
        {
            Debug.LogError("audioSource (AudioSource) is null (heroController)");
        }

        isMove      = false;
        world.x     = Screen.width / 2;
        world.y     = Screen.height / 2;
        speed       = speedStart;
        rotate      = transform.eulerAngles.z;
        maxOpenPath = node.nodeOpen.Count;

        if (rotate == 0f)
        {
            direct = Vector2.up;
        }
        else if (rotate == 90f)
        {
            direct = Vector2.left;
        }
        else if (rotate == 180f)
        {
            direct = Vector2.down;
        }
        else if (rotate == 270f)
        {
            direct = Vector2.right;
        }

        InvokeRepeating("TeleportReload", 0, 1f);
    }
Example #26
0
 // Use this for initialization
 void Start()
 {
     money = 20;
     waitTime = Random.Range(5,30);
     sm = GameObject.FindGameObjectWithTag("scoreManagerTag").GetComponent<scoreManager>();
 }
Example #27
0
 void Start()
 {
     singleton = this;
     applyScore();
 }
Example #28
0
 void Awake()
 {
     scoreMgr = GameObject.FindObjectOfType <scoreManager>();
 }
Example #29
0
    // Use this for initialization
    void Start()
    {
        thescoreManager = FindObjectOfType <scoreManager>();

        coinSound = GameObject.Find("CoinSound").GetComponent <AudioSource>();
    }
Example #30
0
 void start()
 {
     SCManager                = FindObjectOfType <scoreManager>();
     SCManager.scoreCount     = 0;
     SCManager.scoreIncreases = true;
 }
Example #31
0
    // Start is called before the first frame update
    void Start()
    {
        health = 100;

        score = GameObject.FindWithTag("score").GetComponent <scoreManager>();
    }
Example #32
0
	void Awake() {
		instance = this;
	}
Example #33
0
 void Awake()
 {
     rocket       = GetComponent <Rigidbody2D>();
     fire         = gameObject.transform.GetChild(0).gameObject;
     scoreManager = FindObjectOfType <scoreManager>();
 }
Example #34
0
 // start is never called, but kept here for debugging purposes
 void Start()
 {
     rn             = GetComponent <Renderer>();
     sm             = scoreManager.GetComponent <scoreManager>();
     linearMovement = new Vector3(-.5f, 0f, 0f);
 }
Example #35
0
 void Start()
 {
     singleton = this;
     applyScore();
 }