void Awake() // Runs regardless if script is enabled
 {
     floorMask        = LayerMask.GetMask("Floor");
     playerAnim       = GetComponent <Animator>();
     playerRigidBody  = GetComponent <Rigidbody>();
     playerBaseScript = GetComponent <PlayerBaseScript>();
     staticSpeed      = speed;
 }
Esempio n. 2
0
    void Start()
    {
        //Instantiate(Canvas);

        playerBaseScript            = GameObject.FindGameObjectWithTag("PlayerBase").GetComponent <PlayerBaseScript>();
        playerBaseScript.GSDuration = 4f;
        (h, w) = (15, 15);
        CreateGameField(h, w);
        RandomPlayerPosition(); //places playerBase to random map point


        //PathFinder pathFinder = new PathFinder(new Vector2(-7, -7), new Vector2(7, 7));
        //List<Vector2> path = pathFinder.GetPath();
    }
Esempio n. 3
0
    public void BuySellResources()
    {
        PlayerBaseScript playerBase = GameObject.FindGameObjectWithTag("PlayerBase").GetComponent <PlayerBaseScript>();

        if (playerBase.CreditsNum + CreditsGet >= 0 && playerBase.GoodsNum + GoodsGet >= 0)
        {
            playerBase.CreditsNum += CreditsGet;
            playerBase.GoodsNum   += GoodsGet;
        }
        else
        {
            GameController.NoResourcesEvent.Invoke();
        }
        ClearInputs();
    }
Esempio n. 4
0
    // Update is called once per frame
    void Update()
    {
        if (!trigger)
        {
            playerBase = GameObject.FindGameObjectWithTag("PlayerBase").GetComponent <PlayerBaseScript>();
            LevelUp.onClick.AddListener(PlayerBaseScript.barracks.LevelUp);
            TrainUnits.onClick.AddListener(UpdateData);
            ClearInputs();
            trigger = true;
        }

        UnitsNum.text = " UnitsNum: " + PlayerBaseScript.barracks.UnitsNum +
                        " / " + PlayerBaseScript.barracks.UnitsLimit;
        SUnitsNum.text = "S Units: " + PlayerBaseScript.barracks.SUnitsNum;
        AUnitsNum.text = "A Units: " + PlayerBaseScript.barracks.AUnitsNum;
        DUnitsNum.text = "D Units: " + PlayerBaseScript.barracks.DUnitsNum;
        Attack.text    = "Attack: " + playerBase.Attack;
        Defense.text   = "Defense " + playerBase.Defense;

        Level.text       = "Level: " + PlayerBaseScript.barracks.Level;
        LevelUpCost.text = "Cost : (C) and (G) " +
                           GameController.LevelUpPrice(PlayerBaseScript.barracks.Level);
        MakeCorrect();
    }
Esempio n. 5
0
 // Start is called before the first frame update
 void Start()
 {
     playerBase = GameObject.FindGameObjectWithTag("PlayerBase").GetComponent <PlayerBaseScript>();
 }
Esempio n. 6
0
 void Awake()
 {
     playerBaseScript = FindObjectOfType <PlayerBaseScript>();
 }