Exemplo n.º 1
0
        public void mh_MouseDownEvent(object sender, MouseEventArgs e)
        {
            LogHelper.ShowLog("鼠标按键 {0}", e.Button.ToString());
            if (e.Button == MouseButtons.Left)
            {
                LogHelper.ShowLog("按下了左键");
                mouseStatus.leftDown = true;

                // 判断是否需要压枪
                if (player.runLogic)
                {
                    // 判断是否开镜
                    // 常规开镜
                    if (jichuViewModel.KaiJingMeth)
                    {
                        // 判断射击模式
                        // TODO 同步验证是否需要延迟验证
                        Task.Run(() =>
                        {
                            Thread.Sleep(10);
                            FireLogic.ValiShoot(globalParam, player);
                            FireLogic.OpenFire();
                        });
                    }
                    else
                    {
                        // 快速开镜 异步延迟检查是否为开镜射击射击
                        player.isShoot = true;
                        Task.Run(() =>
                        {
                            Thread.Sleep(100);
                            FireLogic.ValiShoot(globalParam, player);
                        });
                        Task.Run(() =>
                        {
                            FireLogic.OpenFire();
                        });
                    }
                }

                // TODO 执行相关逻辑
            }
            else if (e.Button == MouseButtons.Right)
            {
                LogHelper.ShowLog("按下了右键");
                mouseStatus.rightDown = true;
            }
            else if (e.Button == MouseButtons.XButton1)
            {
                player.autoShoot = true;
                LogHelper.ShowLog("自动射击");
                Task.Run(() =>
                {
                    FireLogic.AutoShoot();
                });
            }
            startPoint = e.Location;
        }
Exemplo n.º 2
0
    IEnumerator DestroyFireTile(FireLogic script)
    {
        yield return(new WaitForEndOfFrame());

        script.AddScore();

        if (script.parentTilemap)
        {
            script.parentTilemap.SetTile(script.tilemapPos, null);
        }
    }
Exemplo n.º 3
0
    public override bool StartUp(Vector3Int position, ITilemap tilemap, GameObject go)
    {
        // Streangly the position of gameobject starts at Left Bottom point of cell and not at it center
        if (go)
        {
            go.transform.position += Vector3.up * 0.5f + Vector3.right * 0.5f;

            FireLogic script = prefab.GetComponent <FireLogic>();
            Tilemap   tm     = tilemap.GetComponent <Tilemap>();
            script.parentTilemap = tm;
        }

        return(base.StartUp(position, tilemap, go));
    }
Exemplo n.º 4
0
 private void OnTriggerStay2D(Collider2D other)
 {
     if (other.CompareTag("Fire"))
     {
         FireLogic script = other.gameObject.GetComponent <FireLogic>();
         if (script && script.parentTilemap)
         {
             StartCoroutine(DestroyFireTile(script));
         }
         else
         {
             Destroy(other);
         }
     }
 }