Exemple #1
0
        public void Awake()
        {
            agent = GetComponent <NavMeshAgent>();

            var fruitStrongObj = GameObject.Find("FruitStrong");

            if (fruitStrongObj == null)
            {
                Debug.LogError("FruitStrong GameObject is not found");
            }
            else
            {
                fruitStrong = fruitStrongObj.GetComponent <FruitStrong>();
            }

            var decoyMasterObj = GameObject.Find("DecoyMaster");

            if (decoyMasterObj == null)
            {
                Debug.LogError("DecoyMaster GameObject is not found.");
            }
            else
            {
                decoyMaster = decoyMasterObj.GetComponent <DecoyMaster>();
                if (decoyMaster == null)
                {
                    Debug.LogError("DecoyMaster Component is not attached to DecoyMaster GameObject.");
                }
            }
        }
Exemple #2
0
        public new void Start()
        {
            base.Start();

            fruitStrong = GameObject.Find("FruitStrong").GetComponent <FruitStrong>();
            if (fruitStrong == null)
            {
                Debug.LogError("FruitStrong GameObject is not found.");
            }
        }
        public void Awake()
        {
            var fruitStrongObj = GameObject.Find("FruitStrong");

            originalMaterial = GetComponent <Renderer>().material;

            if (fruitStrongObj == null)
            {
                Debug.LogError("FruitStrong GameObject is not found");
            }
            else
            {
                fruitStrong = fruitStrongObj.GetComponent <FruitStrong>();
                IsStrong.Subscribe(isStrong => {
                    if (isStrong == true)
                    {
                        GetComponent <Renderer>().material = strongMaterial;
                    }
                    else
                    {
                        GetComponent <Renderer>().material = originalMaterial;
                    }
                }).AddTo(gameObject);
            }
            var fruitFeverObj = GameObject.Find("FruitFever");

            effect = GetComponentInChildren <ParticleSystem>();

            if (fruitFeverObj == null)
            {
                Debug.LogError("FruitFever GameObject is not found");
            }
            else
            {
                fruitFever = fruitFeverObj.GetComponent <FruitFever>();
                IsFever.Subscribe(isFever =>
                {
                    if (isFever == true)
                    {
                        effect.Play();
                    }
                    else
                    {
                        effect.Stop();
                    }
                }).AddTo(gameObject);
            }

            captureAudio = GetComponent <AudioSource>();
            Assert.IsNotNull(captureAudio);
        }