Beispiel #1
0
 // Start is called before the first frame update
 void Start()
 {
     uiManager          = GameObject.FindGameObjectWithTag("UIManager").GetComponent <UI_Manager>();
     uiUtils            = uiManager.GetComponent <UI_Utilities>();
     selectionManager   = GameObject.FindGameObjectWithTag("Selection Manager").GetComponent <SelectionManager>();
     currentActionTiles = new List <GameObject>();
 }
Beispiel #2
0
    void Start()
    {
        //rhIKReturn = rightHandIK.transform.position;
        //leftHandIK.transform.position;

        //GunModel.transform.SetParent(HandBone);

        recoilRatio = 0.4f;
        isAimming   = false;
        aimSpeed    = 1.2f;
        canFire     = false;
        boltLocked  = false;
        chambered   = false;

        for (int i = 0; i < clipCount; i++)
        {
            clips[i] = clipSize;
            Debug.Log("Clip" + i + ": " + clips[i]);
        }
        Debug.Log("Current Clip:" + currentClip);

        GUI.GetComponent <UI_Manager>().updateClips(clipCount, clips, clipSize);
    }
Beispiel #3
0
    public void DisplayUnitActions(Unit unit)
    {
        ClearActionsPanel();

        if (unit is IAttacking)
        {
            // Create tile
            Action newAction = new Action(
                "Attack",
                uiManager.GetComponent <UI_TileManager>().UI_Action_Attack
                );
            GameObject newProducableUnitTile = uiUtils.createTile(newAction);
            currentActionTiles.Add(newProducableUnitTile);

            // Button event
            newProducableUnitTile.GetComponent <Button>().onClick.AddListener(delegate() {
                // Action
                //unit.GetComponent<Unit_GroundRanged>().attack(unit.transform.position);
            });
        }
        if (unit is IMovable)
        {
            // MOVE:
            // Create tile
            Action newAction = new Action(
                "Move",
                uiManager.GetComponent <UI_TileManager>().UI_Action_Move
                );
            GameObject newProducableUnitTile = uiUtils.createTile(newAction);
            currentActionTiles.Add(newProducableUnitTile);

            // Button event
            newProducableUnitTile.GetComponent <Button>().onClick.AddListener(delegate()
            {
                // Move Player to next valid click or cancel
                print("Move unit clicked");
                Debug.Log("Move unit clicked");
                selectionManager.sendingMoveOrder = true;
            });

            // STOP:
            // Create tile
            newAction = new Action(
                "Stop",
                uiManager.GetComponent <UI_TileManager>().UI_Action_Stop
                );
            newProducableUnitTile = uiUtils.createTile(newAction);
            currentActionTiles.Add(newProducableUnitTile);

            // Button event
            newProducableUnitTile.GetComponent <Button>().onClick.AddListener(delegate()
            {
                // Action
                unit.movement.stopMoving();
            });
        }
        if (unit is IMovable && unit is IAttacking)
        {
            // Create tile
            Action newAction = new Action(
                "Attack Move",
                uiManager.GetComponent <UI_TileManager>().UI_Action_AttackMove
                );
            GameObject newProducableUnitTile = uiUtils.createTile(newAction);
            currentActionTiles.Add(newProducableUnitTile);

            // Button event
            newProducableUnitTile.GetComponent <Button>().onClick.AddListener(delegate()
            {
                // Action
                // ...
            });
        }
    }