コード例 #1
0
ファイル: ColorCube.cs プロジェクト: Zekzek/RavenousVoid
    private void OnTriggerEnter(Collider other)
    {
        if (!following && other.gameObject.tag == "Player")
        {
            HudDisplay.AddPower(this, powerContained);
            following = true;
            transform.SetParent(other.transform);

            goToMover.target = other.transform;
            colorize.LightUp = true;
            MusicBehaviour.SpeedUp();
            return;
        }

        Shadow otherShadow = other.gameObject.GetComponent <Shadow>();

        if (following && otherShadow != null && !attackTargets.Contains(otherShadow))
        {
            attackTargets.Add(otherShadow);
            if (primaryTarget == null)
            {
                primaryTarget = otherShadow;
                otherShadow.SlowDown();
                MusicBehaviour.SpeedUp();
            }
        }
    }
コード例 #2
0
    void Awake()
    {
        audioSource = GetComponent <MusicBehaviour>();

        foreach (var card in pool)
        {
            card.CardClicked += (s, e) =>
            {
                CardClicked?.Invoke(this, e);
            };
        }
    }
コード例 #3
0
    void Awake()
    {
        if (instance != null && instance != this)
        {
            Destroy(this.gameObject);
            return;
        }
        else
        {
            instance = this;
        }

        DontDestroyOnLoad(this.gameObject);
    }
コード例 #4
0
 void Awake()
 {
     if (instance == null)
     {
         DontDestroyOnLoad(transform.gameObject);
         instance = this;
         //if (fadeIn)
         //{
         //    fadeImg.color = new Color(fadeImg.color.r, fadeImg.color.g, fadeImg.color.b, 1.0f);
         //}
     }
     else
     {
         Destroy(transform.gameObject);
     }
 }
コード例 #5
0
ファイル: ColorCube.cs プロジェクト: Zekzek/RavenousVoid
 private void OnTriggerExit(Collider other)
 {
     if (following && other.gameObject.tag == "Enemy")
     {
         Shadow otherShadow = other.gameObject.GetComponent <Shadow>();
         if (attackTargets.Contains(otherShadow))
         {
             attackTargets.Remove(otherShadow);
             if (primaryTarget.Equals(otherShadow))
             {
                 primaryTarget.SpeedUp();
                 MusicBehaviour.SlowDown();
                 primaryTarget = attackTargets.Count == 0 ? null : attackTargets[0];
             }
         }
     }
 }
コード例 #6
0
    void Awake()
    {
        _resources     = new IslandResources();
        _lifeformDeck  = GetComponent <LifeformDeck>();
        _planetDeck    = GetComponent <PlanetDeck>();
        audioSource    = GetComponent <MusicBehaviour>();
        highestWorship = _resources.Worship;

        _lifeformDeck.CardClicked += LifeformDeck_CardClicked;
        _planetDeck.CardClicked   += PlanetDeck_CardClicked;

        endTurn.onClick.AddListener(new UnityAction(() => {
            _state = GameState.RoundOver;
        }));

        gameOver.onClick.AddListener(new UnityAction(() => {
            SceneManager.LoadScene("main");
        }));

        musicPlaying = PlayerPrefs.GetInt("music", 1) == 1;
        if (musicPlaying)
        {
            musicLabel.text = "Music On";
        }
        else
        {
            musicLabel.text = "Music Off";
        }

        var musicController = GetComponent <MusicBehaviour>();

        musicButton.onClick.AddListener(new UnityAction(() => {
            musicPlaying = !musicPlaying;
            if (musicPlaying)
            {
                musicLabel.text = "Music On";
            }
            else
            {
                musicLabel.text = "Music Off";
            }
            musicController.ToggleMusic(musicPlaying);
        }));
    }