예제 #1
0
파일: AI.cs 프로젝트: rotorist/FringeWorlds
    // Use this for initialization
    public virtual void Initialize(MacroAIParty party, Faction faction)
    {
        RunningNodeHist = new MaxStack <string>(20);

        AimSkill                     = UnityEngine.Random.Range(0.6f, 1f);
        MyShip                       = transform.GetComponent <ShipBase>();
        AvoidanceDetector            = MyShip.MyReference.AvoidanceDetector;
        AvoidanceDetector.ParentShip = MyShip;

        Whiteboard = new Whiteboard();
        Whiteboard.Initialize();

        //AttackTarget = GameManager.Inst.PlayerControl.PlayerShip;

        //Whiteboard.Parameters["TargetEnemy"] = AttackTarget;
        Whiteboard.Parameters["SpeedLimit"] = -1f;

        MyParty       = party;
        MyFaction     = faction;
        MyPartyNumber = MyParty.PartyNumber;

        WeaponControl = new AIWeaponControl();
        WeaponControl.Initialize(this);

        TreeSet = new Dictionary <string, BehaviorTree>();
        TreeSet.Add("BaseBehavior", GameManager.Inst.DBManager.XMLParserBT.LoadBehaviorTree("BaseBehavior", this, party));
        TreeSet.Add("Travel", GameManager.Inst.DBManager.XMLParserBT.LoadBehaviorTree("Travel", this, party));
        TreeSet.Add("FollowFriendly", GameManager.Inst.DBManager.XMLParserBT.LoadBehaviorTree("FollowFriendly", this, party));
        TreeSet.Add("FighterCombat", GameManager.Inst.DBManager.XMLParserBT.LoadBehaviorTree("FighterCombat", this, party));
        TreeSet.Add("BigShipCombat", GameManager.Inst.DBManager.XMLParserBT.LoadBehaviorTree("BigShipCombat", this, party));
    }
예제 #2
0
 // Use this for initialization
 void Start()
 {
     // Get our Whiteboard component from the whiteboard object
     this.whiteboard = GameObject.Find("Whiteboard").GetComponent <Whiteboard>();
     whiteboard.SetColor(Color.blue);
     this.InteractableObjectGrabbed += new InteractableObjectEventHandler(GrabObject);
 }
예제 #3
0
    // Update is called once per frame
    void Update()
    {
        Vector3 tipPos = _tip.transform.position;

        if (Physics.Raycast(tipPos, transform.up, out touch, drawThresHold))
        {
            if (touch.collider.tag == "Whiteboard")
            {
                // Debug.Log("Poop");
                this._whiteboard = touch.collider.gameObject.GetComponent <Whiteboard>();

                _whiteboard.SetColour(penColor);
                _whiteboard.SetTouchPosition(touch.textureCoord.x, touch.textureCoord.y);
                _whiteboard.ToggleTouch(true);



                if (!lastTouch)
                {
                    lastTouch = true;
                    lastAngle = this.transform.rotation;
                }
            }
            else
            {
                _whiteboard.ToggleTouch(false);
                lastTouch = false;
            }
        }
        if (lastTouch)
        {
            transform.rotation = lastAngle;
        }
    }
예제 #4
0
        public bool Create(CreateTeamDTO teamDTO)
        {
            var team = _context.Teams.FirstOrDefault(t => t.Name.Equals(teamDTO.Name));

            if (team != null)
            {
                return(false);
            }
            var whiteboard = new Whiteboard
            {
                Posts = new List <Post>()
            };

            team = new Team
            {
                Name       = teamDTO.Name,
                Members    = new List <User>(),
                Whiteboard = whiteboard
            };
            _context.Teams.Add(team);
            if (_context.SaveChanges() == 0)
            {
                return(false);
            }

            return(true);
        }
        public async Task <IActionResult> CreateNew(int user, [FromBody] WhiteboardDtoIn boardDto)
        {
            var owner = await _userService.GetById(user);

            if (owner == null)
            {
                return(BadRequest("Could not find User associated to the Owner field"));
            }

            var board = new Whiteboard()
            {
                Id    = boardDto.Id,
                Title = boardDto.Title,
                User  = owner
            };

            try
            {
                await _boardService.Create(board);

                return(CreatedAtAction(nameof(GetById), new { id = boardDto.Id }, boardDto));
            }
            catch (WhiteboardException ex)
            {
                return(BadRequest(new { message = ex.Message }));
            }
        }
예제 #6
0
        protected override void Execute()
        {
            base.Execute();
            logger.Trace("Execute() ...");

            Whiteboard.SaveLayout();
            logger.Trace("Execute() ...");
        }
예제 #7
0
    void Update()
    {
        float   tipHeight = transform.Find("Tip").transform.localScale.y;
        Vector3 tip       = transform.Find("Tip/TouchPoint").transform.position;

        whiteboard.SetPenSize(100);
        //Debug.Log(tip);

        if (lastTouch)
        {
            tipHeight *= 1.1f;
        }

        if (Physics.Raycast(tip, transform.up, out touch, tipHeight))
        {
            if (touch.collider.tag == "Whiteboard")
            {
                this.whiteboard = touch.collider.GetComponent <Whiteboard>();

                whiteboard.SetColor(myColor);
                whiteboard.SetTouchPosition(touch.textureCoord.x, touch.textureCoord.y);
                whiteboard.ToggleTouch(true);


                if (lastTouch == false)
                {
                    lastTouch = true;
                    lastAngle = transform.rotation;
                }
            }
            else if (touch.collider.tag == "Wallboard")
            {
                this.wallboard = touch.collider.GetComponent <WallBoard>();

                wallboard.SetColor(myColor);
                wallboard.SetTouchPosition(touch.textureCoord.x, touch.textureCoord.y);
                wallboard.ToggleTouch(true);


                if (lastTouch == false)
                {
                    lastTouch = true;
                    lastAngle = transform.rotation;
                }
            }
        }
        else
        {
            whiteboard.ToggleTouch(false);
            lastTouch = false;
        }


        if (lastTouch)
        {
            transform.rotation = lastAngle;
        }
    }
예제 #8
0
        public async Task Update(Whiteboard boardIn)
        {
            var board = await GetById(boardIn.Id);

            board.Title = boardIn.Title;

            _ctx.Whiteboards.Update(board);
            await _ctx.SaveChangesAsync();
        }
        internal Whiteboard GetById(int id)
        {
            Whiteboard data = _repo.GetById(id);

            if (data == null)
            {
                throw new Exception("Invalid id");
            }
            return(data);
        }
예제 #10
0
        internal Whiteboard Edit(Whiteboard updated)
        {
            string sql = @"
        UPDATE whiteboards
        SET
            name = @Name
        WHERE id = @Id;";

            _db.Execute(sql, updated);
            return(updated);
        }
예제 #11
0
        internal Whiteboard Edit(Whiteboard updated)
        {
            Whiteboard original = GetById(updated.Id);

            if (updated.CreatorId != original.CreatorId)
            {
                throw new Exception("You cannot edit this.");
            }
            updated.Name = updated.Name != null ? updated.Name : original.Name;
            return(_repo.Edit(updated));
        }
예제 #12
0
파일: WhiteboardPen.cs 프로젝트: cule1/CLUE
    // Use this for initialization
    void Start()
    {
        // Get our Whiteboard component from the whiteboard object
        this.whiteboard = GameObject.Find("Whiteboard").GetComponent <Whiteboard>();

        Texture2D newTex = new Texture2D(textureSize, textureSize);

        eraser = newTex.GetPixel(0, 0);

        isPen = true;
    }
예제 #13
0
    public void SendBattleWinEvent()
    {
        var         userProfile = Whiteboard.Get <UserProfile>(GameConstants.Player.PLAYER_PROFILE);
        RewardEvent rewardEvent = new RewardEvent();

        rewardEvent.EventType = RewardEvent.Types.RewardEventType.BattleWin;
        rewardEvent.UserId    = userProfile.UserId;
        Request request = RequestGenerator.CreateRequest(RequestType.RewardUser, rewardEvent.ToByteString());

        NetworkManager.Instance.SendRequest(request, OnRewardReceived);
    }
예제 #14
0
        internal Whiteboard Delete(int id, string userId)
        {
            Whiteboard original = GetById(id);

            if (userId != original.CreatorId)
            {
                throw new Exception("You cannot delete this.");
            }
            _repo.Delete(id);
            return(original);
        }
예제 #15
0
    // Update is called once per frame
    void Update()
    {
        Vector3 tip = Tip.transform.position;

        if (NetworkPlayer != null)
        {
            if (NetworkPlayer.GlobalSyncingManager.NetworkPlayerIdOfWritingPlayer <= 0 || NetworkPlayer.GlobalSyncingManager.NetworkPlayerIdOfWritingPlayer == NetworkPlayer.netId.Value)
            {
                if (Physics.Raycast(tip, transform.up, out hit, RaycastLenght))
                {
                    if (!(hit.collider.tag == "Whiteboard"))
                    {
                        return;
                    }

                    //tip is touching whiteboard
                    this.Whiteboard = hit.collider.GetComponent <Whiteboard>();

                    // set touch position only if touch position change to previous frane
                    if (_lastX != hit.textureCoord.x || _lastY != hit.textureCoord.y)
                    {
                        NetworkPlayer.SetTouchPosition(hit.textureCoord.x, hit.textureCoord.y, Color, 1);
                    }

                    // store touch position
                    _lastX = hit.textureCoord.x;
                    _lastY = hit.textureCoord.y;

                    // if in previous frame the tip didnt touch, set touch to true
                    if (!lastTouch)
                    {
                        NetworkPlayer.ToggleTouch(true);
                        lastTouch = true;
                        lastAngle = transform.rotation;
                    }
                }
                // tip is not touching
                else
                {
                    // if in previous frame the tip touched, set touch to true
                    if (lastTouch)
                    {
                        NetworkPlayer.ToggleTouch(false);
                    }
                    lastTouch = false;
                }

                if (lastTouch)
                {
                    transform.rotation = lastAngle;
                }
            }
        }
    }
예제 #16
0
        protected override void OnInitialized()
        {
            Whiteboard.OnStroke(async stroke =>
            {
                await _context.StrokeAsync(stroke);
                await _context.FlushAsync();
            });

            Whiteboard.OnWipe(async wipe =>
            {
                await _context.WipeAsync(wipe);
                await _context.FlushAsync();
            });

            Whiteboard.OnFill(async fill =>
            {
                await _context.FillAsync(fill);
                await _context.FlushAsync();
            });

            Whiteboard.OnClear(async clear =>
            {
                await _context.ClearAsync(clear);
                await _context.FlushAsync();
            });

            Whiteboard.OnUndo(async undo =>
            {
                System.Console.WriteLine("Undo");
                await _context.ClearAsync(Clear.All);
                foreach (var action in Whiteboard.Actions)
                {
                    if (action is Stroke stroke)
                    {
                        await _context.StrokeAsync(stroke);
                    }
                    else if (action is Wipe wipe)
                    {
                        await _context.WipeAsync(wipe);
                    }
                    else if (action is Fill fill)
                    {
                        await _context.FillAsync(fill);
                    }
                    else if (action is Clear clear)
                    {
                        await _context.ClearAsync(clear);
                    }
                }

                await _context.FlushAsync();
            });
        }
예제 #17
0
    private void Update()
    {
        //if (collision.collider.tag == "WritableSurface")
        //{
        // send a raycast out to the whiteboard
        Vector3 dir;

        if (isEraser)
        {
            dir = -transform.up;
        }
        else
        {
            dir = transform.right;
        }

        if (Physics.Raycast(transform.position, dir, out touchPos, 0.015f))
        {
            if (touchPos.collider.tag == "Whiteboard_Surface")
            {
                //Debug.Log("Hit Surface - " + touchPos.collider.gameObject.name);
                //pos.transform.position = touchPos.point;

                currentBoard = touchPos.collider.GetComponent <Whiteboard>();

                // generate texture blob with correct colour (basically an array of colours, the length of the number of pixels to be drawn)
                color = Enumerable.Repeat(penColor, penSize * penSize).ToArray();

                Debug.Log("Texture Coords: " + touchPos.textureCoord);
                currentBoard.UpdateTouching(true);
                currentBoard.UpdateWhiteboard(touchPos.textureCoord, color, penSize);
            }
            else
            {
                if (currentBoard != null)
                {
                    currentBoard.UpdateTouching(false);
                    currentBoard = null;
                }
            }
        }
        else
        {
            if (currentBoard != null)
            {
                currentBoard.UpdateTouching(false);
                currentBoard = null;
            }
        }
        // collision.gameObject.GetComponent<Whiteboard>().UpdateWhiteboard(this.transform.position,penColor, penSize);
        //}
    }
예제 #18
0
        internal Whiteboard Create(Whiteboard newWhiteboard)
        {
            string sql = @"
      INSERT INTO whiteboards
      (creatorId, name, public)
      VALUES
      (@CreatorId, @Name, @Public);
      SELECT LAST_INSERT_ID();";
            int    id  = _db.ExecuteScalar <int>(sql, newWhiteboard);

            newWhiteboard.Id = id;
            return(newWhiteboard);
        }
예제 #19
0
        public async Task <ActionResult <Whiteboard> > CreateAsync([FromBody] Whiteboard newWhiteboard)
        {
            try
            {
                Profile userInfo = await HttpContext.GetUserInfoAsync <Profile>();

                newWhiteboard.CreatorId = userInfo.Id;
                newWhiteboard.Creator   = userInfo;
                return(Ok(_service.Create(newWhiteboard)));
            }
            catch (System.Exception err)
            {
                return(BadRequest(err.Message));
            }
        }
예제 #20
0
        internal string Create(Stickynote pm)
        {
            Whiteboard whiteboard = _whiteboardsrepo.GetById(pm.WhiteboardId);

            if (whiteboard == null)
            {
                throw new Exception("Not a valid whiteboard");
            }
            if (whiteboard.CreatorId != pm.CreatorId)
            {
                throw new Exception("You are not the owner of this whiteboard");
            }
            _repo.Create(pm);
            return("Created");
        }
예제 #21
0
        public async Task <Whiteboard> Create(Whiteboard whiteboard)
        {
            if (await _ctx.Whiteboards.AnyAsync(
                    w => w.Title == whiteboard.Title &&
                    w.User.Id == whiteboard.User.Id))
            {
                throw new WhiteboardException("You already have a whiteboard with this title");
            }

            await _ctx.Whiteboards.AddAsync(whiteboard);

            await _ctx.SaveChangesAsync();

            return(whiteboard);
        }
예제 #22
0
    // Update is called once per frame
    void Update()
    {
        float   tipHeight = transform.Find("Tip").transform.localScale.y;
        Vector3 tip       = transform.Find("Tip/TouchPoint").transform.position;

        Debug.Log(tip);

        if (lastTouch)
        {
            tipHeight *= 1.1f;
        }

        // Check for a Raycast from the tip of the pen
        if (Physics.Raycast(tip, transform.up, out touch, tipHeight))
        {
            if (!(touch.collider.tag == "Whiteboard"))
            {
                return;
            }
            this.whiteboard = touch.collider.GetComponent <Whiteboard>();

            // Give haptic feedback when touching the whiteboard
            controllerActions.TriggerHapticPulse(0.05f);

            // Set whiteboard parameters
            whiteboard.SetColor(Color.blue);
            whiteboard.SetTouchPosition(touch.textureCoord.x, touch.textureCoord.y);
            whiteboard.ToggleTouch(true);

            // If we started touching, get the current angle of the pen
            if (lastTouch == false)
            {
                lastTouch = true;
                lastAngle = transform.rotation;
            }
        }
        else
        {
            whiteboard.ToggleTouch(false);
            lastTouch = false;
        }

        // Lock the rotation of the pen if "touching"
        if (lastTouch)
        {
            transform.rotation = lastAngle;
        }
    }
예제 #23
0
        public async Task <ActionResult <Whiteboard> > Edit([FromBody] Whiteboard updated, int id)
        {
            try
            {
                Profile userInfo = await HttpContext.GetUserInfoAsync <Profile>();

                updated.CreatorId = userInfo.Id;
                updated.Id        = id;
                updated.Creator   = userInfo;
                return(Ok(_service.Edit(updated)));
            }
            catch (System.Exception err)
            {
                return(BadRequest(err.Message));
            }
        }
예제 #24
0
    void Start()
    {
        var playerStatus  = Whiteboard.Get <StartUpResponse.Types.PlayerStatus>(GameConstants.Player.STARTUP_PLAYER_STATUS);
        var playerProfile = Whiteboard.Get <UserProfile>(GameConstants.Player.PLAYER_PROFILE);

        if (playerStatus == StartUpResponse.Types.PlayerStatus.PlayerFound)
        {
            Util.Log("Player Found");
            Hashtable table = new Hashtable();
            table.Add(GameConstants.Player.PLAYER_PROFILE, playerProfile);
            ActionManager.instance.TriggerEvent(StringConstants.EventNames.UPDATE_PLAYER_PROFILE, table);
        }
        else if (playerStatus == StartUpResponse.Types.PlayerStatus.PlayerNotFound)
        {
            Hashtable table = new Hashtable();
            table.Add(StringConstants.PropertyName.EVENT_NAME, StringConstants.EventNames.OPEN_USER_REGISTRATION);
            ActionManager.instance.TriggerEvent(StringConstants.EventNames.OPEN_USER_REGISTRATION, table);
        }
    }
예제 #25
0
    public void HandleStartupResponse(string requestId)
    {
        StartUpResponse startUpResponse = NetworkManager.Instance.GetResponse <StartUpResponse>(requestId);

        Debug.Log(" startup response received ");
        Debug.Log(" startup status : " + startUpResponse.StartupStatus.ToString());
        Debug.Log(" player status : " + startUpResponse.PlayerStatus.ToString());

        if (startUpResponse.StartupStatus == StartUpResponse.Types.StartupResponseStatus.MajorUpdate)
        {
            ActionManager.instance.TriggerEvent("OpenUserLogin");
            //PopupManager.Instance.CreatePopup("Major Update", startUpResponse.Message, "update", null, delegate	{
            //	Debug.LogError(" going to update page ");
            //});
            return;
        }
        else if (startUpResponse.StartupStatus == StartUpResponse.Types.StartupResponseStatus.MinorUpdate)
        {
            //PopupManager.Instance.CreatePopup("Minor Update", startUpResponse.Message, "update", "skip", delegate {
            //	Debug.LogError(" going to update page ");
            //},
            //delegate {

            //});
        }

        if (startUpResponse.PlayerStatus == StartUpResponse.Types.PlayerStatus.PlayerBanned)
        {
            //PopupManager.Instance.CreatePopup("Banned!!", startUpResponse.Message, "update", null, delegate	{
            //	Debug.LogError(" close the game ");
            //});
            return;
        }
        else if (startUpResponse.PlayerStatus == StartUpResponse.Types.PlayerStatus.PlayerNotFound ||
                 startUpResponse.PlayerStatus == StartUpResponse.Types.PlayerStatus.PlayerFound)
        {
            Whiteboard.SetProperty(GameConstants.Player.STARTUP_PLAYER_STATUS, startUpResponse.PlayerStatus);
            Whiteboard.SetProperty(GameConstants.Player.PLAYER_PROFILE, startUpResponse.PlayerProfile);
            SceneManager.LoadScene("GameScene");
            return;
        }
    }
예제 #26
0
파일: testDrawLine.cs 프로젝트: cule1/CLUE
    // Use this for initialization
    void Start()
    {
        LineRenderer lineRenderer = gameObject.AddComponent <LineRenderer>();

        lineRenderer.material       = new Material(Shader.Find("Sprites/Default"));
        lineRenderer.startColor     = Color.blue;
        lineRenderer.endColor       = Color.blue;
        lineRenderer.startWidth     = 0.005f;
        lineRenderer.endWidth       = 0.005f;
        lineRenderer.numCapVertices = 1;
        lineRenderer.SetPosition(0, transform.position);
        lineRenderer.SetPosition(1, transform.position);

        m_bIsDraw    = true;
        m_bIsDrawing = false;


        m_preForwardVector = new Vector3(0.0f, 0.0f, 0.0f);
        this.whiteboard    = GameObject.Find("Whiteboard").GetComponent <Whiteboard>();
    }
예제 #27
0
    public Team()
    {
        this.coffeeMachine = new CoffeeMachine();
        this.whiteboard    = new Whiteboard();
        this.networkSwitch = new NetworkSwitch();
        this.phone         = new Phone();
        this.toilet        = new Toilet();

        this.players = new List <Player>();
        for (int i = 0; i < 4; i++)
        {
            this.players.Add(new Player(i));
        }

        this.tasks = Task.CreateTaskTree(); // Creates a new tree via the factory method

        this.completed = new List <Task>();
        this.completed.Add(this.tasks);

        this.available = GetAvailableTasks();
    }
예제 #28
0
    public override void Initialize(MacroAIParty party, Faction faction)
    {
        RunningNodeHist = new MaxStack <string>(20);
        MyShip          = transform.GetComponent <ShipBase>();


        Whiteboard = new Whiteboard();
        Whiteboard.Initialize();

        //AttackTarget = GameManager.Inst.PlayerControl.PlayerShip;

        //Whiteboard.Parameters["TargetEnemy"] = AttackTarget;
        Whiteboard.Parameters["SpeedLimit"] = -1f;

        MyParty   = party;
        MyFaction = faction;

        TreeSet = new Dictionary <string, BehaviorTree>();
        TreeSet.Add("BaseBehavior", GameManager.Inst.DBManager.XMLParserBT.LoadBehaviorTree("BaseBehavior", this, party));
        TreeSet.Add("APTravel", GameManager.Inst.DBManager.XMLParserBT.LoadBehaviorTree("APTravel", this, party));
        TreeSet.Add("FollowFriendly", GameManager.Inst.DBManager.XMLParserBT.LoadBehaviorTree("FollowFriendly", this, party));
    }
예제 #29
0
        private static Whiteboard CreateStructure()
        {
            Whiteboard w = new Whiteboard();
            w.EnableDeletion = true;
            w.EnableFiltering = true;
            w.EnableHeaders = false;
            w.Name = "Whiteboard1";
            w.PageSize = 8;

            Whiteboard.Column c1 = new Whiteboard.Column();
            c1.Caption = "Patient";
            c1.Position = 0;
            c1.Type = "InPlaceEdit";
            w.Columns.Add(c1);

            Whiteboard.Column c2 = new Whiteboard.Column();
            c2.Caption = "Doctor";
            c2.Position = 1;
            c2.Type = "InPlaceEdit";
            w.Columns.Add(c2);

            w.Save();
            return w;
        }
예제 #30
0
    // Use this for initialization
    void Start()
    {
        this.whiteboard = GameObject.Find("Whiteboard").GetComponent <Whiteboard>();

        GetComponent <VRTK_ControllerEvents>().TriggerPressed += new ControllerInteractionEventHandler(DoTriggerPressed);
    }
예제 #31
0
 // Use this for initialization
 void Start()
 {
     // Get our Whiteboard component from the whiteboard object
     this.whiteboard = GameObject.Find("Whiteboard").GetComponent <Whiteboard>();
 }
        private void RenderCellToPdf(Section section, Whiteboard.Cell cell)
        {
            // Header
            Paragraph paragraph = section.AddParagraph();
            paragraph.Format.SpaceBefore = new Unit(10, UnitType.Point);
            paragraph.Format.LeftIndent = new Unit(10, UnitType.Point);
            paragraph.Format.Font.Color = Color.FromCmyk(100, 30, 20, 50);
            paragraph.AddFormattedText(
                cell.Column.Caption,
                TextFormat.Bold);

            // Value
            string value = cell.Value ?? "";
            paragraph = section.AddParagraph();
            paragraph.Format.LeftIndent = new Unit(20, UnitType.Point);
            paragraph.Format.Font.Color = Color.FromCmyk(100, 120, 120, 120);
            paragraph.AddFormattedText(value);
        }
예제 #33
0
        protected void CreateNewWhiteboard(object sender, ActiveEventArgs e)
        {
            // Closing window...
            ActiveEvents.Instance.RaiseClearControls("dynPopup");

            string name = e.Params["WhiteboardName"].Get<string>();
            Whiteboard w = new Whiteboard {Name = name};
            w.Save();

            // Open whiteboard that was just created...
            EditWhiteboard(w.ID);

            RefreshMenu();

            ActiveEvents.Instance.RaiseActiveEvent(
                this,
                "WhiteboardWasCreated");
        }