示例#1
0
 private void Start()
 {
     cameraObject = GameObject.Find("Main Camera").GetComponent <AudioManager>();
     hbM          = FindObjectOfType <HotbarManager>();
     itD          = FindObjectOfType <ItemDictionary>();
     itemSprite   = gameObject.GetComponent <SpriteRenderer>();
 }
示例#2
0
 private void SetInstance()
 {
     if (instance == null)
     {
         instance = this;
     }
 }
示例#3
0
    // Use this for initialization
    void Awake()
    {
        _plantationParent = new GameObject("PlantationParent");
        //_upgradeManager = FindObjectOfType<PlantationUpgradeManager>();
        _gameController = FindObjectOfType <GameController>();
        _hotbarManager  = FindObjectOfType <HotbarManager>();
        SpawnPlantation(_spawnLocation);
        _toPlace.enabled = true;
        _toPlace         = null;
        _currencyManager = FindObjectOfType <CurrencyManager>();


        /*_upgradeManager.HealthUpgraded += UpgradeHealth;
         * _upgradeManager.LPSUpgraded += UpgradeLPS;
         * _upgradeManager.RegenUpgraded += UpgradeRegen;
         * _upgradeManager.LeavesUpgraded += (upgrade) => {
         *  _selectedPlantation.TeaLeafValue = (int)upgrade.Value;
         *  _selectedPlantation.TeaLeafColour = upgrade.Colour;
         * };*/

        GetComponent <Button>().onClick.AddListener(() =>
        {
            if (CanPlacePlantation() && _currencyManager.Spend(TEA_PLANTATION_COST))
            {
                SpawnPlantation(Camera.main.ScreenToWorldPoint(Input.mousePosition));
            }
        });
    }
示例#4
0
 private void Start()
 {
     Time.timeScale = 1f;
     canMove        = true;
     rb             = GetComponent <Rigidbody2D>();
     hbM            = GameObject.Find("HotbarManager").GetComponent <HotbarManager>();
     anim           = gameObject.GetComponent <Animator>();
     knockBackPoint = GameObject.Find("PlayerReturnPoint");
 }
示例#5
0
 private void Start()
 {
     aus = gameObject.transform.GetComponent <AudioSource>();
     if (isNPC)
     {
         questMarker = gameObject.transform.parent.GetChild(2).GetComponent <Sprite>();
     }
     hbM = FindObjectOfType <HotbarManager>();
     QM  = FindObjectOfType <QuestManager>();
 }
示例#6
0
    void UpdateHotbar()
    {
        int newSelection = HotbarManager.GetSelected();

        //Surely a better way
        if (Input.GetKeyDown(KeyCode.Alpha1))
        {
            newSelection = 0;
        }
        if (Input.GetKeyDown(KeyCode.Alpha2))
        {
            newSelection = 1;
        }
        if (Input.GetKeyDown(KeyCode.Alpha3))
        {
            newSelection = 2;
        }
        if (Input.GetKeyDown(KeyCode.Alpha4))
        {
            newSelection = 3;
        }
        if (Input.GetKeyDown(KeyCode.Alpha5))
        {
            newSelection = 4;
        }
        if (Input.GetKeyDown(KeyCode.Alpha6))
        {
            newSelection = 5;
        }
        if (Input.GetKeyDown(KeyCode.Alpha7))
        {
            newSelection = 6;
        }
        if (Input.GetKeyDown(KeyCode.Alpha8))
        {
            newSelection = 7;
        }
        if (Input.GetKeyDown(KeyCode.Alpha9))
        {
            newSelection = 8;
        }

        //Mouse wheel
        if (Input.GetAxis("Mouse ScrollWheel") > 0f)
        {
            newSelection--;
        }
        if (Input.GetAxis("Mouse ScrollWheel") < 0f)
        {
            newSelection++;
        }

        HotbarManager.SetSelected(newSelection);
    }
示例#7
0
 private void Awake()
 {
     gameTileManager     = setTileManager;
     character           = setCharacter;
     inventoryManager    = setInventoryManager;
     hotbarManager       = setHotbarManager;
     cropsTileManager    = setCropsTileManager;
     dateManager         = setDateManager;
     questManager        = setQuestManager;
     relationshipManager = setRelationshipManager;
     skillsManager       = setSkillsManager;
     dialogueManager     = setDialogueManager;
     explorationManager  = setExplorationManager;
 }
示例#8
0
 public void InventoryRemove(Item item) => HotbarManager.RemoveItem(selectedItem);
示例#9
0
 public void InventoryAdd(Item item) => HotbarManager.AddItem(item);
示例#10
0
 public override void Interact()
 {
     HotbarManager.AddItem(this);
     gameObject.SetActive(false);
 }
示例#11
0
 void Start()
 {
     hbM = FindObjectOfType <HotbarManager>().GetComponent <HotbarManager>();
 }
 void Awake()
 {
     _hotbarManager   = FindObjectOfType <HotbarManager>();
     _currencyManager = FindObjectOfType <CurrencyManager>();
 }