Example #1
0
        //public void HandleBattleCommandExecuteUnitActions(NetReceivedData receivedData)
        //{
        //	if (receivedData.data is BattleCommandExecuteUnitActions battleCommand)
        //	{
        //		receivedData.requestHandled = true;

        //		// TODO: Handle all unit actions

        //		// TODO: Await completion of all unit actions

        //		receivedData.SendResponse(true);
        //	}
        //}
        #endregion


        #region Managing units
        private void SpawnUnitFor(UnitInstanceData unitInstanceData)
        {
            BattleUnit battleUnit = Instantiate(battleUnitPrefab, unitSpawnParent);

            battleUnit.Initialize(unitInstanceData);
            spawnedUnits.Add(battleUnit);
        }
Example #2
0
        public void Initialize(UnitInstanceData unitInstanceData)
        {
            unitInstanceId = unitInstanceData.unitInstanceId;
            SetAttack(unitInstanceData.attack);
            SetCount(unitInstanceData.count);
            playerId             = unitInstanceData.playerId;
            isFriendlyUnit.Value = playerId == BBClient.Instance.PlayerId;

            SetColor();

            tile = BattleController.Instance.board[unitInstanceData.x, unitInstanceData.y];
            transform.position = tile.centerTransform.position;
        }