Пример #1
0
 // Use this for initialization
 void Awake()
 {
     ui  = FindObjectOfType <FlyUI>();
     giv = FindObjectOfType <GiveEnemy>();
     gt  = FindObjectOfType <GetThing>();
     au  = FindObjectOfType <MusicAll>();
 }
Пример #2
0
        /// <summary>
        /// Map Things endpoints.
        /// </summary>
        /// <param name="endpoint"></param>
        /// <exception cref="ArgumentNullException"></exception>
        public static void MapThings(this IEndpointRouteBuilder endpoint)
        {
            if (endpoint == null)
            {
                throw new ArgumentNullException(nameof(endpoint));
            }

            endpoint.MapGet("/things", GetAllThings.InvokeAsync);
            endpoint.MapGet("/things/{name}", context => context.WebSockets.IsWebSocketRequest
                ? WebSocket.InvokeAsync(context) : GetThing.InvokeAsync(context));
            endpoint.MapGet("/things/{name}/properties", GetProperties.InvokeAsync);
            endpoint.MapGet("/things/{name}/properties/{property}", GetProperty.InvokeAsync);
            endpoint.MapPut("/things/{name}/properties/{property}", PutProperty.InvokeAsync);
            endpoint.MapGet("/things/{name}/events", GetEvents.InvokeAsync);
            endpoint.MapGet("/things/{name}/events/{event}", GetEvent.InvokeAsync);
            endpoint.MapPost("/things/{name}/actions", PostActions.InvokeAsync);
            endpoint.MapGet("/things/{name}/actions", GetActions.InvokeAsync);
            endpoint.MapPost("/things/{name}/actions/{action}", PostAction.InvokeAsync);
            endpoint.MapGet("/things/{name}/actions/{action}", GetAction.InvokeAsync);
            endpoint.MapGet("/things/{name}/actions/{action}/{id}", GetActionById.InvokeAsync);
            endpoint.MapDelete("/things/{name}/actions/{action}/{id}", DeleteAction.InvokeAsync);

            //To Force bind
            endpoint.ServiceProvider.GetService <IEnumerable <Thing> >();
        }
Пример #3
0
 // Use this for initialization
 void Start()
 {
     fb   = FindObjectOfType <FireBoom>();
     rb   = GetComponent <Rigidbody2D>();
     move = FindObjectOfType <Move>();
     gt   = FindObjectOfType <GetThing>();
 }
Пример #4
0
 void Awake()
 {
     au  = FindObjectOfType <MusicAll>();
     gt  = FindObjectOfType <GetThing>();
     gun = this.GetComponent <BossGun>();
     giv = FindObjectOfType <GiveEnemy>();
 }
Пример #5
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetMouseButtonDown(0))
        {
            RaycastHit hit;
            Ray        ray = cam.ScreenPointToRay(Input.mousePosition);

            if (Physics.Raycast(ray, out hit))
            {
                unitCtrl.targetTile = hit.transform;
                targetTile          = hit.transform;

                //State Map
                if (state == ControlState.Map && !camManager.camMoving)
                {
                    if (oldRender != null)
                    {
                        oldRender.color = new Color(255, 255, 255);
                    }

                    //Get Tile Selected
                    SpriteRenderer sprLine = hit.transform.GetChild(0).GetComponent <SpriteRenderer>();
                    oldRender     = sprLine;
                    sprLine.color = new Color(0, 255, 0);

                    //Move Camera
                    StartCoroutine(camManager.LerpCam(cam.transform.position, camManager.camPosStatic(targetTile.position)));

                    //Get Tile Info
                    TileData tileInfo = hit.transform.GetComponent <TileData>();

                    //Get Unit Info
                    if (tileInfo.haveUnit)
                    {
                        unitUIInfo(tileInfo.UnitOn.GetComponent <UnitInfo>(), null, true);
                    }
                    else
                    {
                        unitUIInfo(null, null, false);
                    }

                    //UI Manage
                    tileInfoPanel.SetActive(true);
                    tileInfoText.text = GetThing.getTileType(targetTile);
                }
                else if (state == ControlState.Move)
                {
                    if (unitCtrl.targetTile.GetComponentInParent <TileData>().canMoveTo)
                    {
                        //print(targetTile.GetComponentInParent<TileData>().canMoveTo);
                        TileData data = unitOnControl.GetComponent <UnitInfo>().tileOn.GetComponent <TileData>();
                        data.haveUnit    = false;
                        data.canMoveTo   = true;
                        unitCtrl.allPath = PathManager.DoMovePath(unitOnControl.GetComponent <UnitInfo>().tileOn, targetTile, unitOnControl, this.GetComponent <PlayerController>());
                        unitCtrl.unit.GetComponent <UnitInfo>().isMoving = true;
                        PathManager.DoHideMovableTile();
                        controlPanel.SetActive(false);
                    }
                }
                else if (state == ControlState.Attack)
                {
                    if (targetTile.GetComponent <TileData>().UnitOn != null)
                    {
                        PathManager.DoHideMovableTile();
                        Transform unitTarget = targetTile.GetComponent <TileData>().UnitOn;
                        battle.DoBattle(unitOnControl, unitTarget);
                        turn.FinishAction();
                        controlPanel.SetActive(true);
                    }
                }
            }
        }
    }
Пример #6
0
 // Use this for initialization
 void Start()
 {
     gt = FindObjectOfType <GetThing>();
 }