コード例 #1
0
ファイル: base_item.cs プロジェクト: oznogongames/DatRepo
    // Use this for initialization
    void Start()
    {
        // Correct init logics

        if (GetComponent <CoinSpin>() != null)
        {
            coin = GetComponent <CoinSpin>();
        }

        if (GetComponent <AudioSource>() != null)
        {
            //Audi = GetComponent<AudioSource>();
        }
        this.tag         = Globals.TAGS.Item;
        this.award_Flame = Mathf.Max(award_Flame, 0f);
        if (monitor == null)
        {
            monitor = Session_Monitor.Instance;
            Audi    = ((AudioSource )monitor.gameObject.GetComponent <AudioSource>());
        }
        if (dragonSM == null)
        {
            dragonSM = FindObjectsOfType <HealthMonitor>().First(t => t.tag == Globals.TAGS.Player);
        }
        Audi = ((AudioSource)monitor.gameObject.GetComponent <AudioSource>());
        if (GetComponent <CoinSpin>() == null)
        {
            Audi = null;
        }
        p = FindObjectOfType <Perks>();
    }
コード例 #2
0
    private void OnTriggerEnter(Collider other)
    {
        switch (other.tag)
        {
        case "Collectable":
            coin = other.gameObject.GetComponent <CoinSpin>();
            print(coin.name);
            coins++;
            text.text        = string.Format("Coins: {0}", coins);
            coin.isCollected = true;
            break;

        case "Finish":
            gameManager.LoadNextLevel();
            break;
        }
    }
コード例 #3
0
ファイル: base_item.cs プロジェクト: Zror/DatRepo
    // Use this for initialization
    void Start()
    {
        // Correct init logics

        if (GetComponent<CoinSpin>() != null)
        {
            coin = GetComponent<CoinSpin>();
        }

        if (GetComponent<AudioSource>() != null)
        {
            //Audi = GetComponent<AudioSource>();
        }
        this.tag = Globals.TAGS.Item;
        this.award_Flame = Mathf.Max(award_Flame, 0f);
        if (monitor == null)
        {
            monitor = Session_Monitor.Instance;
            Audi = ((AudioSource )monitor.gameObject.GetComponent<AudioSource>());
        }
        if (dragonSM == null)
        {
            dragonSM = FindObjectsOfType<HealthMonitor>().First(t => t.tag == Globals.TAGS.Player);
        }
        Audi = ((AudioSource)monitor.gameObject.GetComponent<AudioSource>());
        if(GetComponent<CoinSpin>() == null)
        {
            Audi = null;
        }
        p = FindObjectOfType<Perks>();
    }