public void ShowProximityInfo()
        {
            _proximityGiven = false;
            _proximityInfo.Text("Walk towards the stand to interact!", Input.mouseX - 250, Input.mouseY);
            _rectProximityInfo.Rect(Input.mouseX - 15, Input.mouseY - 30, 475, 50);

            foreach (AnimationSprite currentStand in LevelLoader.CollisionObjectList)
            {
                if (currentStand is MarketStand)
                {
                    MarketStand stand = currentStand as MarketStand;
                    if (stand.ProximityToStand)
                    {
                        _proximityGiven = true;
                    }
                }
            }

            if (_proximityGiven && !_textOnceAdded)
            {
                AddChild(_rectProximityInfo);
                AddChild(_proximityInfo);
                _textOnceAdded = true;
            }
            else if (!_proximityGiven)
            {
                RemoveChild(_proximityInfo);
                RemoveChild(_rectProximityInfo);
                _textOnceAdded = false;
            }
        }
示例#2
0
    void Awake()
    {
        Instance        = this;
        questions       = DataManager.GetAnswersOfCurrentScene(SceneManager.GetActiveScene().name);
        moneyBillPrefab = Resources.Load("prefab/MoneyBill") as GameObject;
        backpackPrefab  = Resources.Load("prefab/backpack") as GameObject;
        paperbagPrefab  = Resources.Load("prefab/Paperbag") as GameObject;
        walletPrefab    = Resources.Load("prefab/stand_wallet") as GameObject;
        coinsPrefab     = Resources.Load("prefab/coins") as GameObject;

        waveCanvas = GameObject.Find("WaveCanvas");

        gameObject.AddComponent <GameController>();
    }