Example #1
0
 public ArithmeticLogicUnit(ComputerUnit CPU, Interface view)
 {
     binaryRepresentationOfOne  = "00000000000000000000000000000001";
     binaryRepresentationOfZero = "00000000000000000000000000000000";
     operationMapping           = new OpCodeMapping(this);
     _CPU = CPU;
 }
Example #2
0
    public void AITurnEnd()
    {
        (FindObjectOfType(typeof(AnimateCamera)) as AnimateCamera).TargetObject =
            (FindObjectOfType(typeof(PlayerCharacter)) as PlayerCharacter).gameObject;
        grid.turnManager.PlayerTurn = true;
        spawnedPCs = FindObjectsOfType(typeof(PlayerCharacter)) as PlayerCharacter[];

        for (int i = 0; i < spawnedAIs.Length; i++)
        {
            spawnedAIs[i].EndTurn();
        }

        actingAI = null;

        for(int i = 0; i < spawnedPCs.Length; i++)
        {
            spawnedPCs[i].NewTurn();
        }

        turnCount++;
    }
Example #3
0
    void Selecting()
    {
        RaycastHit hitInfo = new RaycastHit();
        int mask = ~(1 << 8);
        bool hit = Physics.Raycast(Camera.main.ScreenPointToRay(Input.mousePosition), out hitInfo, Mathf.Infinity, mask);

        if (hit)
        {
            if (Input.GetKey(KeyCode.Mouse0))
            {
                if (hitInfo.transform.gameObject.GetComponent<PlayerCharacter>())
                {
                    selectedUnit = hitInfo.transform.gameObject.GetComponent<PlayerCharacter>();
                }
                else if (hitInfo.transform.gameObject.GetComponent<ComputerUnit>())
                {
                    highlightedEnemy = hitInfo.transform.gameObject.GetComponent<ComputerUnit>();
                }
                /*else if (hitInfo.transform.gameObject.GetComponent<MovementPlane>())
                {
                    if (hitInfo.transform.gameObject.GetComponent<MovementPlane>().planeEnabled)
                    {
                        if (hitInfo.transform.gameObject.GetComponent<MovementPlane>().IsAttack)
                            hitInfo.transform.gameObject.GetComponent<MovementPlane>().ExecuteAttack();
                        else
                        {
                            hitInfo.transform.gameObject.GetComponent<MovementPlane>().parentUnit
                        }
                    }
                }*/
            }
            else
            {
                if (hitInfo.transform.gameObject.GetComponent<TileObject>())
                    mouseOverObject = hitInfo.transform.gameObject;
                else if (hitInfo.transform.gameObject.GetComponent<MovementPlane>() != null)
                {
                    if (hitInfo.transform.gameObject.GetComponent<MovementPlane>().IsAttack)
                    {

                        mouseOverObject = hitInfo.transform.gameObject;
                    }
                }
            }
        }
        else
            mouseOverObject = null;
    }
Example #4
0
    /*public void StartCPUTurn()
    {
        spawnedAIs[0].IsTurn = true;
    }*/
    IEnumerator StartCPUTurn()
    {
        spawnedAIs = (FindObjectsOfType(typeof(ComputerUnit)) as ComputerUnit[]);
        for (int i = 0; i < spawnedAIs.Length; i++)
        {
            actingAI = spawnedAIs[i];
            (FindObjectOfType(typeof(AnimateCamera)) as AnimateCamera).TargetObject = spawnedAIs[i].gameObject;
            while (actingAI == spawnedAIs[i])
            {
                yield return null;
            }
        }

        AITurnEnd();
    }
Example #5
0
 public Decoder(Instruction cbr, ComputerUnit cpu)
 {
     CBR = cbr;
     Cpu = cpu;
 }