void client_MqttMsgPublishReceived(object sender, MqttMsgPublishEventArgs e)
    {
        Debug.Log("Received: " + System.Text.Encoding.UTF8.GetString(e.Message));
        Debug.Log(e.Topic);

        if (e.Topic == "/DanceMorpher/cameras/positions")
        {
            string msg = System.Text.Encoding.UTF8.GetString(e.Message);
            print(msg);

            setCamerasString = msg;
            // this stuff will be handled by 'Update()' because Unity wants it so
        }

        if (e.Topic == "/DanceMorpher/resetscenedontusethis")
        {
            Debug.Log("Reset Scene!!!");
            HitHandler.resetSceneDontUseThis();
        }

        if (e.Topic == "/DanceMorpher/reloadmesh")
        {
            Debug.Log("Reload Mesh");
            HitHandler.reloadMesh();
        }
    }
Exemple #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            this.header1.PageInfo = PageInfo.DemosRelative;

            HesterConsultants.AppCode.HitHandler hit1 = new HitHandler(this, this.pageId);
            hit1.HandlePage();
        }
Exemple #3
0
    public bool hit = false;                            // 接触した
#endif


    /// <summary>
    /// 起動
    /// </summary>
    /// <param name="category">判定カテゴリ</param>
    /// <param name="hitHandler">衝突処理</param>
    public void WakeUp(COL_CATEGORY category, HitHandler hitHandler)
    {
        this.enable     = true;
        this.hitHandler = hitHandler;
        this.category   = category;
        this.SetCircle(10f); // デフォ設定
    }
Exemple #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            this.Response.Cache.SetCacheability(HttpCacheability.NoCache);

            if (curClient == null)
            {
                return;
            }

            GetJob();
            if (curJob == null)
            {
                return;
            }

            // if it's not this client's job
            // && not admin user, don't show anything
            CheckJobIsForClient();
            UpdatePickedUpJob();
            SetControls();

            HitHandler hit1 = new HitHandler(this, this.pageId);

            hit1.HandlePage();
        }
    /// <summary>
    /// 全起動
    /// </summary>
    public void WakeUp()
    {
        Debug.Assert(!this.awake, "CollisionPart 二重起動");

        Vector3 worldPoint = this.trans_.position;

        this.camera_     = Camera.main;
        this.cameraTrans = this.camera_.transform;

        // コリジョン呼び出し
        this.centerPoint = this.camera_.WorldToScreenPoint(worldPoint);
        for (int i = 0; i < this.collisionCount; ++i)
        {
            this.collisions[i] = GameManager.collision.PickOut(this.category);
            if (this.collisions[i] != null)
            {
                this.collisions[i].enable     = true;
                this.collisions[i].range      = this.collisionDatas[i].range;
                this.collisions[i].hitHandler = this.hitHandler;

                Vector3 offset = this.collisionDatas[i].offset;
                this.collisions[i].point.x = this.centerPoint.x + offset.x;
                this.collisions[i].point.y = this.centerPoint.y + offset.y;
            }
        }
        this.awake = true;
    }
        protected void Page_Load(object sender, EventArgs e)
        {
            pageId = 16;
            HitHandler hit1 = new HitHandler(this, pageId);

            hit1.HandlePage();
        }
 /// <summary>
 /// 初期化
 /// </summary>
 /// <param name="category">コリジョンカテゴリ</param>
 /// <param name="hitHandler">接触処理</param>
 public void Initialize(COL_CATEGORY category, HitHandler hitHandler)
 {
     this.trans_         = this.transform;
     this.category       = category;
     this.hitHandler     = hitHandler;
     this.collisionCount = this.collisionDatas.Length;
     this.collisions     = new Collision[this.collisionCount];
 }
Exemple #8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            isAdmin = User.IsInRole(Settings.Default.RoleAdmin);
            GetData();
            this.lvFoundJobs.DataBind(); // need this b/c of viewstate

            HitHandler hit1 = new HitHandler(this, this.pageId);

            hit1.HandlePage();
        }
        public void GivenNullShip_DoesNotAddPointToPlayerScore()
        {
            var   playerScore = new Mock <IPlayerScore>();
            IShip ship        = null;

            var hitHandler = new HitHandler(playerScore.Object, ship);

            hitHandler.Execute();

            playerScore.Verify(x => x.AddPoint(), Times.Never());
        }
Exemple #10
0
 void Awake()
 {
     sharedInstance   = this;
     enemyInDirection = new Dictionary <Direction, Enemy>
     {
         { Direction.UP, null },
         { Direction.DOWN, null },
         { Direction.LEFT, null },
         { Direction.RIGHT, null },
     };
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            this.odsCurrentInvoice.SelectParameters.Clear();

            GetAccountData();
            SetControls();

            HitHandler hit1 = new HitHandler(this, pageId);

            hit1.HandlePage();
        }
Exemple #12
0
 void OnTriggerEnter2D(Collider2D col)//when hitting something do things
 {
     if (GetComponent <SpriteRenderer>().isVisible)
     {
         if (col.GetComponent <HitHandler>())
         {
             enemyScript = col.GetComponent <HitHandler>();
             enemyScript.Hit();
         }
     }
 }
Exemple #13
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //debug
            //CacheLayer.ClearCache();

            header1.PageInfo = PageInfo.HomeRelative;

            HesterConsultants.AppCode.HitHandler hit1 = new HitHandler(this, this.pageId);
            hit1.HandlePage();

            SetControls();
        }
 /// <summary>
 /// 初期化
 /// </summary>
 /// <param name="category">コリジョンカテゴリ</param>
 /// <param name="hitHandler">接触処理</param>
 public void Initialize(COL_CATEGORY category, HitHandler hitHandler)
 {
     this.trans_         = this.transform;
     this.category       = category;
     this.hitHandler     = hitHandler;
     this.collisionCount = this.collisionDatas.Length;
     this.collisions     = new Collision[this.collisionCount];
     this.rotations      = new Quaternion[this.collisionCount];
     for (int i = 0; i < this.collisionCount; ++i)
     {
         this.rotations[i] = Quaternion.identity;
     }
 }
        public void GivenNotNullShip_AddsPointsToPlayerScore()
        {
            var       playerScore = new Mock <IPlayerScore>();
            var       ship        = new Mock <IShip>();
            const int nrOfRepeats = 5;

            for (int i = 0; i < nrOfRepeats; i++)
            {
                var hitHandler = new HitHandler(playerScore.Object, ship.Object);
                hitHandler.Execute();
            }

            playerScore.Verify(x => x.AddPoint(), Times.Exactly(nrOfRepeats));
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            FormsAuthentication.SignOut();
            this.Session[Global.SESSION_CLIENT] = null;

            this.Response.Redirect("/", false);

            HitHandler hit1 = new HitHandler(this, this.pageId);

            hit1.HandlePage();

            //this.Session.Abandon();
            HttpContext.Current.ApplicationInstance.CompleteRequest();
        }
Exemple #17
0
        protected void Page_Load(object sender, EventArgs e)
        {
            this.Response.Cache.SetCacheability(HttpCacheability.NoCache);

            if (curClient == null)
            {
                return;
            }

            SetControls();

            HitHandler hit1 = new HitHandler(this, this.pageId);

            hit1.HandlePage();
        }
Exemple #18
0
        public IShot Shoot(string coordinates)
        {
            int[] coordsInt = Helpers.TranslateCoordinates(coordinates);
            var   shot      = new Shot(Battlefield, coordsInt);

            if (!shot.IsShotValid())
            {
                return(null);
            }

            shot.Fire();
            var hitHandler = new HitHandler(playerScore, shot.HitShip);

            hitHandler.Execute();
            return(shot);
        }
Exemple #19
0
        protected void Page_Load(object sender, EventArgs e)
        {
            this.Response.Cache.SetCacheability(HttpCacheability.NoCache);
            this.header1.PageInfo = PageInfo.ClientsRelative;

            if (curClient == null)
            {
                return;
            }

            GetData();

            HitHandler hit1 = new HitHandler(this, this.pageId);

            hit1.HandlePage();
        }
Exemple #20
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (curClient == null)
            {
                return;
            }

            this.Response.Cache.SetCacheability(HttpCacheability.NoCache);

            Debug.WriteLine("postback: " + this.IsPostBack.ToString());
            if (!this.IsPostBack)
            {
                SetControls();
            }

            HitHandler hit1 = new HitHandler(this, this.pageId);

            hit1.HandlePage();
        }
Exemple #21
0
    void setCameras(string camerasString)
    {
        string[] cameras = camerasString.Split(';');

        foreach (string c in cameras)
        {
            string[] pos = c.Split('/');

            if (pos [0] != myCameraName)
            {
                print(pos [0]);
                print(pos [1]);
                print(pos [2]);

                setCameraPosition(pos [0], getVector3(pos [1]), getVector3(pos [2]));

                // ask HitHAndler to look for hits for these cameras
                HitHandler.lookForHit(pos [0]);
            }
        }
    }
    /// <summary>
    /// コリジョンの取得
    /// </summary>
    /// <param name="category">コリジョン種別</param>
    /// <param name="hitHandler">接触コールバック</param>
    public Collision PickOut(COL_CATEGORY category, HitHandler hitHandler)
    {
        if (this.pool.count < 1)
        {
            Debug.Assert(false, "コリジョン不足");
            return(null);
        }

        int       split = 0;
        Collision col   = this.pool.PickOutLast();

        col.WakeUp(category, hitHandler);
        switch (category)
        {
        case COL_CATEGORY.PLAYER:
            this.players.Attach(col);
            break;

        case COL_CATEGORY.PL_BULLET:
            split             = this.plAwakeSplit;
            this.plAwakeSplit = ++this.plAwakeSplit % COL_SPLIT;
            this.plBullets[split].Attach(col);
            break;

        case COL_CATEGORY.ENEMY:
            this.enemies.Attach(col);
            break;

        case COL_CATEGORY.EN_BULLET:
            split             = this.enAwakeSplit;
            this.enAwakeSplit = ++this.enAwakeSplit % COL_SPLIT;
            this.enBullets[split].Attach(col);
            break;
        }

        return(col);
    }
    /// <summary>
    /// コリジョンの取得
    /// </summary>
    /// <param name="category">コリジョン種別</param>
    /// <param name="hitHandler">接触コールバック</param>
    public Collision PickOut(COL_CATEGORY category, HitHandler hitHandler = null)
    {
        if (this.pool.count < 1)
        {
            Debug.Assert(false, "コリジョン不足");
            return(null);
        }

        Collision col = this.pool.PickOutLast();

        col.WakeUp(category, hitHandler);
        switch (category)
        {
        case COL_CATEGORY.PLAYER:
            this.players.Attach(col);
            break;

        case COL_CATEGORY.ENEMY:
            this.enemies.Attach(col);
            break;
        }

        return(col);
    }
Exemple #24
0
        public void move(int x1, int y1, int x2, int y2)
        {
            // Chain and Responsibility Design Pattern
            MoveHandlerBase targetOutside   = new TargetOutSideHandler();
            MoveHandlerBase noPieceOnSource = new NoPieceOnSourceHandler();
            MoveHandlerBase turn            = new TurnHandler();
            MoveHandlerBase targetOwnPiece  = new TargetOwnPieceHandler();
            MoveHandlerBase collision       = new CollisionHandler();
            MoveHandlerBase illigalMove     = new IlligalMoveHandler();
            MoveHandlerBase hit             = new HitHandler();
            MoveHandlerBase legalMove       = new LegalMoveHandler();


            targetOutside.SetNext(noPieceOnSource);
            noPieceOnSource.SetNext(turn);
            turn.SetNext(targetOwnPiece);
            targetOwnPiece.SetNext(collision);
            collision.SetNext(illigalMove);
            illigalMove.SetNext(hit);
            hit.SetNext(legalMove);


            targetOutside.Handle(x1, y1, x2, y2, Fields);
        }
Exemple #25
0
    public static GameObject CreateLineAoe(string goName, Transform parent, Vector3 goPos, float xSpeed, float maxLength, bool isRight, HitHandler callBack)
    {
        GameObject obj = new GameObject(goName);

        obj.transform.parent        = parent;
        obj.transform.localScale    = Vector3.one;
        obj.transform.localPosition = goPos;
        LineAoeMove move = obj.AddComponent <LineAoeMove>();

        move.xSpeed = xSpeed;
        move.direct = isRight ? Vector3.right : -Vector3.right;
        FightGroup targetGroup = isRight ? (FightGroup)FightManager.GetInstance().enemyGroup : FightManager.GetInstance().mineGroup;

        move.ToHitUnits = new List <FightUnit>(targetGroup.fightUnits);
        move.OnHit      = callBack;
        move.maxLength  = maxLength;
        return(obj);
    }
Exemple #26
0
 /// <summary>
 /// 停止(返却)
 /// </summary>
 public void Sleep()
 {
     this.enable     = false;
     this.hitHandler = null;
 }