Exemplo n.º 1
0
 void Start()
 {
     RS     = GameObject.Find("_PlayerResourcesManager").GetComponent <PlayerResourceManager> ();
     holder = GameObject.Find("_ResourceHolder").GetComponent <MetricsHolder> ();
     totalGlobalAffiliation = holder.globalAffilation;
     CalcTotalAff();
 }
Exemplo n.º 2
0
    void Start()
    {
        r2M = GameObject.Find("Stage2Canvas").GetComponent <Round2Manager> ();
        RS  = GameObject.Find("_PlayerResourcesManager").GetComponent <PlayerResourceManager> ();
        MH  = GameObject.Find("_ResourceHolder").GetComponent <MetricsHolder> ();

        districtAffiliation = Random.Range(30, 60);

        candidates = new List <Politician> ();

        distBizAff = districtAffiliation;
        distCivAff = 100 - districtAffiliation;
        //Debug.Log (this.name + ": " + distBizAff + "% Biz, " + distCivAff + "% Civ.");

        for (int i = 0; i < 3; i++)
        {
            // 4chan.org/pol/
            Politician pol;

            //string[] alphabet = { "Davis ", "Luke ", "Decan ",  "Joseff ", "Aramat ", "Arstok ", "Grant ", "Welkin ", "Vargas ", "Fenn ", "Parker "};



            pol.name            = alphabet [Random.Range(0, alphabet.Length)] + alphabet [Random.Range(0, alphabet.Length)];
            pol.cost            = (Random.Range(2, 10) * 100);
            pol.bizModifier     = Random.Range(-6, 6);
            pol.civModifier     = Random.Range(-6, 6);
            pol.chanceOfWinning = Mathf.Round(Random.Range(0.1f, 0.9f) * Mathf.Pow(10.0f, (float)2)) / Mathf.Pow(10.0f, (float)2);

            candidates.Add(pol);
        }
    }
 private void Start()
 {
     resourceManager = GameObject.FindGameObjectWithTag("MainCamera").GetComponentInChildren <PlayerResourceManager>();
     troopsArray     = new List <GameObject>();
     StartCoroutine(WaitSpawnTroops());
     StartCoroutine(WaitTakeUpKeep());
 }
Exemplo n.º 4
0
    public void OnAddItemsToPot()
    {
        clickSound.Play();

        //SelectetITems
        Dictionary <string, int> selectedItemDict = odenListModel.getSelectedItems();
        int totalUnitOfSelectedItem = odenListModel.getUnitOfItems();
        int totalPurchasePrice      = odenListModel.getTotalPurchasePrice();

        playerResourceManager = playerResourceManagerObj.GetComponent <PlayerResourceManager>();

        bool isSlotEnough  = totalUnitOfSelectedItem <= PlayerDataModel.RemainPotSlot;
        bool isMoneyEnough = totalPurchasePrice <= PlayerDataModel.TotalCoin;

        if (isSlotEnough && isMoneyEnough)
        {
            coinSound.Play();
            playerResourceManager.UpdateItemsInPotSlot(selectedItemDict, totalUnitOfSelectedItem);
            playerResourceManager.UpdateTotalCoin(totalPurchasePrice * -1);
            ClearSelectedItems();
        }
        else
        {
            if (!isMoneyEnough)
            {
                WarningContentTxt.text = "Your coin is not enough";
            }
            else
            {
                WarningContentTxt.text = "Slot id not enough";
            }

            WarningDialog.SetActive(true);
        }
    }
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.gameObject.tag.Equals("Player"))
     {
         PlayerResourceManager.AddResource(gameObject.name, finalAmount);
         Destroy(gameObject);
     }
 }
Exemplo n.º 6
0
    // Use this for initialization
    void Start()
    {
        playerResourceManager = GameObject.Find("PlayerResourceManager").GetComponent <PlayerResourceManager>();

        unitText            = unitTextObj.GetComponent <Text>();
        selectedItemManager = selectedItemManagerPanel.GetComponent <SelectedItemManager>();

        SetMenuInfo();
        SetUnlockedMode(isUnlock);
    }
Exemplo n.º 7
0
        private void Awake()
        {
            var gameManager = FindObjectOfType <GameManager>();

            resourceManager = gameManager.GetService <PlayerResourceManager>();

            resourceManager.StaminaConsumed  += OnStaminaConsumed;
            resourceManager.StaminaRecovered += OnStaminaRecovered;

            gameObject.SetActive(false);
        }
 private void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
     }
     else if (Instance != this)
     {
         Destroy(gameObject);
     }
 }
Exemplo n.º 9
0
    void Start()
    {
        InputController       = WorldMethods.GetInputController();
        UIController          = WorldMethods.GetUIController();
        playerResourceManager = WorldMethods.GetPlayerResourceManager();
        seasonManager         = WorldMethods.GetSeasonManager();
        waitPerTick           = waitPerTickSpeedThree; //Set the game speed to default
        UIController.UIControllerSetup();

        SetUpGame();
    }
Exemplo n.º 10
0
        public void Initialize(PlayerMovementContext context)
        {
            movementContext = context;

            var gameManager = GameObject.FindObjectOfType <GameManager>();

            if (gameManager)
            {
                resourceManager = gameManager.GetService <PlayerResourceManager>();
            }
        }
Exemplo n.º 11
0
    IEnumerator FirePistol()
    {
        Instantiate(projectile, projectileSpawn.transform.position, Quaternion.identity);
        PlayerResourceManager.DecreaseResourceCount(StringConstants.LightAmmo, 1);
        // TODO Shot sfx
        Instantiate(bulletCasing, new Vector3(projectileSpawn.transform.position.x - .5f, projectileSpawn.transform.position.y, projectileSpawn.transform.position.z), Quaternion.identity);
        sprite.sprite       = firingSprite;
        muzzleFlash.enabled = true;
        yield return(new WaitForSeconds(.02f));

        sprite.sprite       = notFiringSprite;
        muzzleFlash.enabled = false;
    }
Exemplo n.º 12
0
    void Start()
    {
        darkOverlayEnabled = false;



        cameraTransform = GameObject.FindGameObjectWithTag("Player").GetComponentInChildren <Camera>().transform;
        playerResources = PlayerResourceManager.Instance;
        shipResources   = ShipResourceManager.Instance;
        systemManager   = ShipSystemManager.Instance;

        EventBox.SetActive(false);
    }
Exemplo n.º 13
0
 void Update()
 {
     if (Input.GetButtonDown("Fire1"))
     {
         if (PlayerResourceManager.GetResourceCount(StringConstants.LightAmmo) > 0)
         {
             StartCoroutine("FirePistol");
         }
         else
         {
             // TODO Click sfx.
         }
     }
 }
Exemplo n.º 14
0
    void Start()
    {
        OnPlayerStateChange += OnPlayerStateChanged;
        state = PlayerState.Sitting;

        cameraController   = GetComponent <FirstPersonCameraController>();
        movementController = GetComponent <MovementController>();
        cameraTransform    = GetComponentInChildren <Camera>().transform;
        uiManager          = UIManager.Instance;
        systemManager      = ShipSystemManager.Instance;
        waterDispenser     = systemManager.GetComponent <WaterDispenser>();
        foodDispenser      = systemManager.GetComponent <FoodDispenser>();
        playerResources    = PlayerResourceManager.Instance;

        uiManager.UpdateTooltipTextSub(null);
        uiManager.UpdateTooltipText("Begin", true);

        StartCoroutine(LateStart());
    }
Exemplo n.º 15
0
    void OnTriggerEnter2D(Collider2D hitInfo)
    {
        PlayerResourceManager player = hitInfo.GetComponent <PlayerResourceManager>();

        if (hitInfo.gameObject.tag == "Player")
        {
            player.TakeDamage(enemyDamage);

            if (!canPiercePlayers)
            {
                Destroy(gameObject);
            }
        }
        if (hitInfo.tag == "Environment")
        {
            if (!canPierceWalls)
            {
                Destroy(gameObject);
            }
        }
    }
Exemplo n.º 16
0
    void Awake()
    {
        currentRoadType = RoadType.Land;
        Road_Color      = new Color(.2f, 0, 0, 1);
        WaterRoad_Color = new Color(1, 0, 0, 1);
        Color_List.Add(Road_Color);
        Color_List.Add(WaterRoad_Color);

        playerResourceManager = GetComponent <PlayerResourceManager>();
        ih         = FindObjectOfType <InputHandler>();
        Land       = GameObject.Find("Land_Tiles");
        Land_Board = Land.GetComponent <SetupGameBoard>();

        Water_Board = GameObject.Find("Water_Tiles").GetComponent <SetupGameBoard>();
        Game_Board  = Land_Board;

        Sprite_List.Add(Road_OneWay_A);
        Sprite_List.Add(Road_OneWay_B);
        Sprite_List.Add(Road_TwoWay_A);
        Sprite_List.Add(Road_TwoWay_B);
        Sprite_List.Add(Road_TwoWay_C);
        Sprite_List.Add(Road_TwoWay_D);
        Sprite_List.Add(Road_ThreeWay_A);
        Sprite_List.Add(Road_ThreeWay_B);
        Sprite_List.Add(Road_ThreeWay_C);
        Sprite_List.Add(Road_ThreeWay_D);
        Sprite_List.Add(Road_FourWay_A);

        Reference_Tile = Resources.Load <GameObject>("Road_Land");

        Placed_Tiles   = new List <GameObject>();
        Tiles_To_Place = new List <GameObject>();

        Placed_Tiles.Add(GameObject.Find("City A"));

        foreach (CityScript obj in GameObject.Find("Cities").GetComponentsInChildren <CityScript>())
        {
            Cities.Add(obj);
        }
    }
Exemplo n.º 17
0
        private void Awake()
        {
            gameManager     = FindObjectOfType <GameManager>();
            resourceManager = gameManager.GetService <PlayerResourceManager>();

            gameManager.Paused += OnPaused;

            input = new PlayerInput();

            input.Player.Move.performed += ctx => playerInput = ctx.ReadValue <Vector2>();
            input.Player.Move.canceled  += _ => playerInput = Vector2.zero;

            input.Player.ToggleWalkRun.performed += _ => ToggleWalking();

            input.Player.Sprint.started  += _ => SetSprinting(true);
            input.Player.Sprint.canceled += _ => SetSprinting(false);

            input.Player.Jump.performed += _ => Jump();

            input.Player.Interact.performed += _ => Interact();

//            input.Player.Dash.performed += _ => Dash();
        }
Exemplo n.º 18
0
    public void UIControllerSetup()
    {
        GameController        = GameObject.Find("GameController").GetComponent <GameController> ();
        inputController       = GameObject.Find("InputController").GetComponent <InputController>();
        playerResourceManager = WorldMethods.GetPlayerResourceManager();

        pauseBoard = GameObject.Find("PauseBoard");

        GameSpeedDisplay = GameObject.Find("GameSpeedDisplay").GetComponent <TextMeshProUGUI> ();
        DaysCounter      = GameObject.Find("DaysCounter").GetComponent <TextMeshProUGUI>();
        MonthsCounter    = GameObject.Find("MonthsCounter").GetComponent <TextMeshProUGUI>();
        YearsCounter     = GameObject.Find("YearsCounter").GetComponent <TextMeshProUGUI>();

        authorityNumber  = GameObject.Find("AuthorityNumber").GetComponent <TextMeshProUGUI>();
        populationNumber = GameObject.Find("PopulationNumber").GetComponent <TextMeshProUGUI>();
        foodNumber       = GameObject.Find("FoodNumber").GetComponent <TextMeshProUGUI>();
        woodNumber       = GameObject.Find("WoodNumber").GetComponent <TextMeshProUGUI>();
        silverNumber     = GameObject.Find("SilverNumber").GetComponent <TextMeshProUGUI>();

        seasonManager = WorldMethods.GetSeasonManager();

        RealDate = GameController.RealDate;
    }
Exemplo n.º 19
0
 void Start()
 {
     playerResources = PlayerResourceManager.Instance;
 }
Exemplo n.º 20
0
 void Start()
 {
     playerResourceManager = gameObject.GetComponent <PlayerResourceManager>();
 }
Exemplo n.º 21
0
 void Awake()
 {
     playerResourceManager = WorldMethods.GetPlayerResourceManager();
 }
Exemplo n.º 22
0
 public PlayerManager()
 {
     unitManager     = new PlayerUnitManager();
     resourceManager = new PlayerResourceManager();
 }
Exemplo n.º 23
0
    public static PlayerResourceManager GetPlayerResourceManager()
    {
        PlayerResourceManager playerResourceManagerToGet = GameObject.Find("PlayerResourceManager").GetComponent <PlayerResourceManager>();

        return(playerResourceManagerToGet);
    }
Exemplo n.º 24
0
    protected override void Start()
    {
        base.Start();

        playerResources = PlayerResourceManager.Instance;
    }
Exemplo n.º 25
0
 // Start is called before the first frame update
 void Start()
 {
     unitManager           = GameObject.Find("UnitManager").GetComponent <UnitManager>();
     playerResourceManager = WorldMethods.GetPlayerResourceManager();
 }