void Start()
 {
     if (instance == null)
     {
         instance = this;
     }
 }
Пример #2
0
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
 }
 protected void OnTriggerEnter(Collider other)
 {
     if (other.gameObject.CompareTag("Player"))
     {
         ScoreManger.AddPoints(pointsToAdd);
         Destroy(gameObject);
     }
 }
 // Update is called once per frame
 void Update()
 {
     if (enemyHealth <= 0)
     {
         Instantiate(deathEffect, transform.position, transform.rotation);
         ScoreManger.AddPoints(pointsOnDeath);
         Destroy(gameObject);
     }
 }
Пример #5
0
 void OnTriggerEnter2D(Collider2D other)
 {
     if (other.name == "Player")
     {
         Instantiate(deathEffect, transform.position, transform.rotation);
         ScoreManger.AddPoints(-pointsOnDeath);
         Destroy(gameObject);
     }
 }
Пример #6
0
    // Use this for initialization
    void Start()
    {
        platformStartPoint = platformGenerator.position;
        bkstartpoint       = bkgenerator.position;
        playerStartPoint   = thePlayer.transform.position;
        startheroCounter   = thePlayer.heroModCounter;



        theScoreManger = FindObjectOfType <ScoreManger>();
    }
Пример #7
0
 private void Awake()
 {
     if (_instance != null && _instance != this)
     {
         Debug.Log("An instance already exists, destroying");
         Destroy(this.gameObject);
     }
     else
     {
         _instance = this;
     }
 }
Пример #8
0
    void OnTriggerEnter2D(Collider2D other)
    {
        if (other.GetComponent <PlayerController>() == null)
        {
            return;
        }

        ScoreManger.AddPoints(pointsToAdd);

        coinSoundEffect.Play();

        Destroy(gameObject);
    }
Пример #9
0
    // Use this for initialization
    void Start()
    {
        platformWidth = thePlatform.GetComponent <BoxCollider2D>().size.x;



        platformWidths = new float[thePlatformsPools.Length];



        for (int i = 0; i < thePlatformsPools.Length; i++)
        {
            platformWidths[i] = thePlatformsPools[i].pooledObject.GetComponent <BoxCollider2D>().size.x;
        }

        minHeight = transform.position.y;
        maxHeight = maxHeightPoint.position.y;

        theCoinGenerator = FindObjectOfType <CoinGenerator>();
        thScoreManger    = FindObjectOfType <ScoreManger>();
    }
Пример #10
0
    public IEnumerator RespawbPlayerCo()
    {
        Instantiate(deathParticle, player.transform.position, player.transform.rotation);
        player.enabled = false;
        player.GetComponent <Renderer>().enabled = false;
        camera.isFollowing = false;
        //gravityStore = player.GetComponent<Rigidbody2D>().gravityScale;
        //player.GetComponent<Rigidbody2D>().gravityScale = 0f;
        //player.GetComponent<Rigidbody2D>().velocity = Vector2.zero;
        ScoreManger.AddPoints(-pointPenaltyOnDeath);
        Debug.Log("Player Reapawn");
        yield return(new WaitForSeconds(respawnDelay));

        //player.GetComponent<Rigidbody2D>().gravityScale = gravityStore;
        player.transform.position = currentCheckpoint.transform.position;
        player.knockbackCount     = 0;
        player.enabled            = true;
        player.GetComponent <Renderer>().enabled = true;
        healthManager.FullHealth();
        healthManager.isDead = false;
        camera.isFollowing   = true;
        Instantiate(respawnParticle, currentCheckpoint.transform.position, currentCheckpoint.transform.rotation);
    }
Пример #11
0
    private void Awake()
    {
        //collectedChars = GameObject.Find("CollectedChars").GetComponent<Text>();
        collectedNumber   = 0;
        collectedPartsNum = 0;

        effectNote = GameObject.Find("EffectNote").GetComponent <Text>();
        noteTime   = 0;

        sentenceCounter = GameObject.Find("SentenceCounter").GetComponent <Text>();

        timeCounter = GameObject.Find("TimeCounter").GetComponent <Text>();
        second      = 0;
        minute      = 0;
        realTime    = 0;

        heartNumber = GameObject.Find("HeartNumber").GetComponent <Text>();
        enterButton = GameObject.Find("EnterButton").GetComponent <Button>();
        escButton   = GameObject.Find("EscButton").GetComponent <Button>();
        escReleased = true;

        enableEnter = false;
        enableEsc   = false;

        you         = GameObject.Find("You").GetComponent <You>();
        scoreManger = GameObject.Find("ScoreManger").GetComponent <ScoreManger>();

        resetTime = 0;
        //Find operators
        operators    = new Text[3];
        operators[0] = GameObject.Find("FirstOperator").GetComponent <Text>();
        operators[1] = GameObject.Find("SecondOperator").GetComponent <Text>();
        operators[2] = GameObject.Find("ThirdOperator").GetComponent <Text>();

        comparator = GameObject.Find("Comparator").GetComponent <Text>();
    }
Пример #12
0
    // Update is called once per frame
    void Update()
    {
        if (enemyHealth <= 0)
        {
            Instantiate(deathEffect, transform.position, transform.rotation);
            ScoreManger.AddPoints(pointsOnDeath);

            if (transform.localScale.y > minSize)
            {
                GameObject clone1 = Instantiate(bossPrefab, new Vector3(transform.position.x + 0.5f, transform.position.y, transform.position.z), transform.rotation) as GameObject;
                GameObject clone2 = Instantiate(bossPrefab, new Vector3(transform.position.x - 0.5f, transform.position.y, transform.position.z), transform.rotation) as GameObject;

                clone1.transform.localScale = new Vector3(transform.localScale.y * 0.7f, transform.localScale.y * 0.7f, transform.localScale.z);
                clone1.GetComponent <BossHealthManager>().enemyHealth = 10;

                clone2.transform.localScale = new Vector3(transform.localScale.y * 0.7f, transform.localScale.y * 0.7f, transform.localScale.z);
                clone2.GetComponent <BossHealthManager>().enemyHealth = 10;
            }



            Destroy(gameObject);
        }
    }
Пример #13
0
 // Use this for initialization
 void Start()
 {
     theScoreManager       = FindObjectOfType <ScoreManger>();
     thePlateformGenerator = FindObjectOfType <PlatformGenerator>();
     theGameManager        = FindObjectOfType <GameManger>();
 }
Пример #14
0
 private void Awake()
 {
     _instance = this;//单例赋值
 }
Пример #15
0
    public void Modify()
    {
        ScoreManger.AddScore(point);

        Destroy(gameObject);
    }
Пример #16
0
    // Use this for initialization
    void Start()
    {
        theScoreManager = FindObjectOfType <ScoreManger>();

        coinSound = GameObject.Find("CoinSound").GetComponent <AudioSource>();
    }
Пример #17
0
 // Use this for initialization
 void Start()
 {
     Scoremangment = FindObjectOfType <ScoreManger> ();
 }
Пример #18
0
 // Use this for initialization
 void Start()
 {
     scoremanger = FindObjectOfType <ScoreManger> ();
 }