Beispiel #1
0
        public void createBoard(GameObject prefab, int x, int y)
        {
            colors = new Dictionary<byte, Color>();
            colors.Add(0, Color.black);
            colors.Add(1, Color.red);
            colors.Add(2, Color.green);
            colors.Add(3, Color.blue);
            colors.Add(4, Color.gray);
            colors.Add(5, Color.cyan);
            colors.Add(6, Color.magenta);
            colors.Add(7, Color.yellow);
            colors.Add(8, Color.white);

            _cellSprite = prefab;
            maxX = x;
            maxY = y;
            _field = new byte[x * y];
            _fieldVisual = new CellRotator[x * y];
            for (int i = 0; i < maxX; i++) {
                for (int j = 0; j < maxY; j++) {
                    var z = Instantiate (_cellSprite);
                    z.transform.position = new Vector2 (j + 0.5f, -i - 0.5f);
                    z.transform.parent = transform;
                    z.name = (i * maxX).ToString() + '_' + j.ToString();
                    _fieldVisual[i * maxX + j] = z.GetComponent<CellRotator> ();
                    _fieldVisual[i * maxX + j].instantOff();
                }
            }

            _state = BoardState.INITIALIZED;
            _mainP = FindObjectOfType<MainProxy>();
            seedPrefab = _mainP.seedPrefab;
        }
Beispiel #2
0
        public void createBoard(GameObject prefab, int x, int y)
        {
            colors = new Dictionary <byte, Color>();
            colors.Add(0, Color.black);
            colors.Add(1, Color.red);
            colors.Add(2, Color.green);
            colors.Add(3, Color.blue);
            colors.Add(4, Color.gray);
            colors.Add(5, Color.cyan);
            colors.Add(6, Color.magenta);
            colors.Add(7, Color.yellow);
            colors.Add(8, Color.white);

            _cellSprite  = prefab;
            maxX         = x;
            maxY         = y;
            _field       = new byte[x * y];
            _fieldVisual = new CellRotator[x * y];
            for (int i = 0; i < maxX; i++)
            {
                for (int j = 0; j < maxY; j++)
                {
                    var z = Instantiate(_cellSprite);
                    z.transform.position = new Vector2(j + 0.5f, -i - 0.5f);
                    z.transform.parent   = transform;
                    z.name = (i * maxX).ToString() + '_' + j.ToString();
                    _fieldVisual[i * maxX + j] = z.GetComponent <CellRotator> ();
                    _fieldVisual[i * maxX + j].instantOff();
                }
            }

            _state     = BoardState.INITIALIZED;
            _mainP     = FindObjectOfType <MainProxy>();
            seedPrefab = _mainP.seedPrefab;
        }
Beispiel #3
0
        IEnumerator Start()
        {
            _game = gameObject.GetComponent <MainProxy>();

            _state  = ConnectionState.UNKNOWN;
            _socket = new WebSocket(new Uri("ws://188.242.130.83:3000/echo"));
            yield return(StartCoroutine(_socket.Connect()));
        }
Beispiel #4
0
 public MainWindowViewModel(MainWindowView mainWindowView, User user)
 {
     MainWindowViewProp = mainWindowView;
     UserProp           = user;
     Proxy = new MainProxy(this);
     Proxy.SubscribeToCallBack(user);
     MainWindowViewProp.Closed += _mainWindowView_Closed;
 }
Beispiel #5
0
        public void initialize(MainProxy game)
        {
            _game = game;
            onPoinerExit();

            _targetInstance = Instantiate(target);
            _targetInstance.transform.position = new Vector3(-100f, 100f);

            _seedTargetInstance = Instantiate(seedTarget);
            _seedTargetInstance.transform.position = new Vector3(-100f, 100f);

            _sim = FindObjectOfType<WorldSimulation>();
        }
Beispiel #6
0
        public void initialize(MainProxy game)
        {
            _game = game;
            onPoinerExit();

            _targetInstance = Instantiate(target);
            _targetInstance.transform.position = new Vector3(-100f, 100f);

            _seedTargetInstance = Instantiate(seedTarget);
            _seedTargetInstance.transform.position = new Vector3(-100f, 100f);

            _sim = FindObjectOfType <WorldSimulation>();
        }
Beispiel #7
0
        public void initialize(byte myId, Camera cam, BoardContainer board, onDeploy call)
        {
            this.myId = myId;
            _cam      = cam;
            _board    = board;
            _onDeploy = call;

            colors = new Dictionary <byte, Color>();
            colors.Add(0, Color.white);
            colors.Add(1, Color.red);
            colors.Add(2, Color.green);
            colors.Add(3, Color.blue);
            colors.Add(4, Color.gray);
            colors.Add(5, Color.cyan);
            colors.Add(6, Color.magenta);
            colors.Add(7, Color.yellow);
            colors.Add(8, Color.white);

            _mainP = GameObject.FindObjectOfType <MainProxy>();
        }
Beispiel #8
0
        public void initialize(byte myId, Camera cam, BoardContainer board, onDeploy call)
        {
            this.myId = myId;
            _cam = cam;
            _board = board;
            _onDeploy = call;

            colors = new Dictionary<byte, Color>();
            colors.Add(0, Color.white);
            colors.Add(1, Color.red);
            colors.Add(2, Color.green);
            colors.Add(3, Color.blue);
            colors.Add(4, Color.gray);
            colors.Add(5, Color.cyan);
            colors.Add(6, Color.magenta);
            colors.Add(7, Color.yellow);
            colors.Add(8, Color.white);

            _mainP = GameObject.FindObjectOfType<MainProxy>();
        }