예제 #1
0
    //  PlayerController pc;


    void Start()
    {

        focusArea = new FocusArea(target.bounds, focusAreaSize);
        // pc = player.GetComponent<PlayerController>();

    }
    void Start()
    {
        gameControl = GameObject.FindGameObjectWithTag("GameController");

        target = GameObject.FindGameObjectWithTag("Player").transform.GetComponent<Controller2D>();
        focusArea = new FocusArea (target.collider.bounds, focusAreaSize);
    }
    void Start()
    {
        min = bounds.bounds.min;
        max = bounds.bounds.max;
        orthographicSize = GetComponent<Camera>().orthographicSize;

        focusArea = new FocusArea(target.collider.bounds, focusAreaSize);
    }
 public void SetTargetPlayer(GameObject targetPlayer)
 {
     this.targetPlayer = targetPlayer;
     //Create array of non-main player objects
     this.targetController = this.targetPlayer.GetComponent<BBController3D>();
     this.targetPlayerBase = this.targetPlayer.GetComponent<BBBasePlayerController>();
     this.focusArea = new FocusArea(this.targetController.boxCollider.bounds, this.focusDimensions);
 }
예제 #5
0
    void Start()
    {
        target    = GameObject.Find("Player").GetComponent <Controller2D>();
        focusArea = new FocusArea(target.collider.bounds, focusAreaSize);

        foreach (Vector3 boundary in localBoundaries)
        {
            globalBoundaries.Add(boundary);
        }

        for (int i = 0; i < localBoundaries.Count; i++)
        {
            globalBoundaries[i] = localBoundaries[i] + transform.position;
        }
    }
        public ActionResult New(EditViewModel viewModel)
        {
            if (!ModelState.IsValid)
            {
                return(ViewEdit(viewModel));
            }
            var focusArea = new FocusArea(string.Empty, ModelObjectHelpers.NotYetAssignedID, ModelObjectHelpers.NotYetAssignedID);

            viewModel.UpdateModel(focusArea);
            HttpRequestStorage.DatabaseEntities.FocusAreas.Add(focusArea);
            HttpRequestStorage.DatabaseEntities.SaveChanges();
            SetMessageForDisplay($"{FieldDefinition.FocusArea.GetFieldDefinitionLabel()} {focusArea.GetDisplayNameAsUrl()} successfully created.");

            return(new ModalDialogFormJsonResult());
        }
예제 #7
0
    void Start()
    {
        target    = FindObjectOfType <Player> ();
        focusArea = new FocusArea(target.controller.boxcollider.bounds, focusAreaSize);

        if (Bounds == null)
        {
            Debug.LogError("Add the Bounds object (BoxCollider2D) to limit the camera", gameObject);
            return;
        }

        _min        = Bounds.bounds.min;
        _max        = Bounds.bounds.max;
        isFollowing = true;
    }
예제 #8
0
    void Start()
    {
        /* Get Player Object. */
        GameObject playerObj = GameObject.Find("Player");

        if (playerObj != null)
        {
            //player = playerObj.GetComponent<CharacterBase>();
            //player = Player.Instance.gameObject.GetComponent<PBaseMovement>();
            player = playerObj.GetComponent <PBaseMovement>();
        }
        //player = Player.Instance.gameObject.GetComponent<PBaseMovement>();


        focusArea = new FocusArea(player.collider.bounds, focusAreaSize);
    }
예제 #9
0
    void Start()
    {
        target = WLD_GameController.player.GetComponent <Collider>();
        player = WLD_GameController.player;

        focusArea          = new FocusArea(target.bounds, focusAreaSize);
        originalVertOffset = verticalOffset;
        currentLevel       = WLD_GameController.activeLevel.LevelName;
        previousLevel      = currentLevel;

        if (zCamDist == 0)
        {
            zCamDist = this.transform.position.z;
        }

        inTeleporter = false;
    }
    PlayerControl player;  //Nosso player está sendo estaciada nessa classe, para que podemos acessar.

    // Use this for initialization
    void Start()
    {
        isFollowing = true;

        //Classes sendo estanciadas.
        focusArea = new FocusArea(target.GetComponent <BoxCollider2D>().bounds, focusAreaSize);
        player    = target.GetComponent <PlayerControl>();
        theCamera = GetComponent <Camera>();

        /* minBounds = boundBox.bounds.min;
         * maxBounds = boundBox.bounds.max;*/

        /*halfHeight = theCamera.orthographicSize;
         * halfWidth = halfHeight * Screen.width / Screen.height;*/

        theCamera.transform.Translate(player.transform.position);
    }
예제 #11
0
    void Start()
    {
        if (target == null)
        {
            GameObject follow = GameObject.FindWithTag("Player");
            if (follow == null)
            {
                Debug.LogError("CameraFollow: No Player found in current Scene.", follow);
            }
            else
            {
                target = follow.GetComponent <Controller2D>();
            }
        }

        focusArea = new FocusArea(target.boxCollider2D.bounds, focusAreaSize);
    }
예제 #12
0
 void Start()
 {
     //Kyle Code
     //looks at all kids and sets the camera to follow the local instance
     PhotonView[] kids = FindObjectsOfType <PhotonView>();
     foreach (PhotonView kid in kids)
     {
         if (kid.IsMine)
         {
             target = kid.gameObject.GetComponent <Controller2D>();
             Debug.Log("Found a kid for the camera to follow");
             return;
         }
     }
     Debug.LogError("No local player instance found, that shouldn't have happened :(");
     //end Kyle code
     focusArea = new FocusArea(target.collider.bounds, focusAreaSize);
 }
예제 #13
0
    private void Start()
    {
        height = Camera.main.orthographicSize * 2;
        width  = height * Camera.main.aspect;

        focusArea = new FocusArea(target.boxCollider.bounds, focusAreaSize);
        spawnPos  = transform.position;

        xPosLimits = new Vector2(
            cameraBoundingWalls.transform.Find("lwall").transform.position.x,
            cameraBoundingWalls.transform.Find("rwall").transform.position.x
            );

        yPosLimits = new Vector2(
            cameraBoundingWalls.transform.Find("floor").transform.position.y,
            cameraBoundingWalls.transform.Find("ceiling").transform.position.y
            );

        startColor = Camera.main.backgroundColor;
    }
예제 #14
0
    public void Init()
    {
        currentLookAheadX   = 0;
        targetLookAheadX    = 0;
        lookAheadDirX       = 0;
        smoothLookVelocityX = 0;

        smoothVelocityY  = 0;
        lookAheadStopped = false;

        //transform.position = target.transform.position;
        focusArea             = new FocusArea(target.myCollider.bounds, focusAreaSize);
        verticalSmoothTimeTmp = verticalSmoothTime;
        scrollingBackgrounds  = FindObjectsOfType <ScrollingBackground>();
        // Save x/y offsets for later camera movements
        Vector2 focusPosition = focusArea.centre + Vector2.up * verticalOffset + Vector2.right * horizontalOffset;

        postInitOffsets.x = focusPosition.x - target.transform.position.x;
        postInitOffsets.y = focusPosition.y - target.transform.position.y;
    }
예제 #15
0
    void LateUpdate()
    {
        if (target == null)
        {
            target    = GameObject.FindWithTag("Player").GetComponent <Controller2D>();
            focusArea = new FocusArea(target.collider.bounds, focusAreaSize);
            return;
        }

        focusArea.Update(target.collider.bounds);

        Vector2 focusPosition = focusArea.center + Vector2.up * verticalOffset;

        if (focusArea.velocity.x != 0)
        {
            lookAheadDirX = Mathf.Sign(focusArea.velocity.x);
            if (Mathf.Sign(controllerData.inputDirection.x) == Mathf.Sign(focusArea.velocity.x) && controllerData.inputDirection.x != 0)
            {
                lookAheadStopped = false;
                targetLookAheadX = lookAheadDirX * lookAheadDstX;
            }
            else
            {
                if (lookAheadStopped == false)
                {
                    lookAheadStopped = true;
                    targetLookAheadX = currentLookAheadX + (lookAheadDirX * lookAheadDstX - currentLookAheadX) / 4f;
                }
            }
        }

        currentLookAheadX = Mathf.SmoothDamp(currentLookAheadX, targetLookAheadX, ref smoothLookVelocityX, lookSmoothTimeX);

        focusPosition += Vector2.right * currentLookAheadX;
        Vector3 newPosition = (Vector3)focusPosition + Vector3.forward * -10;

        newPosition.x = Mathf.Clamp(newPosition.x, this.clampCameraX.x, this.clampCameraX.y);
        newPosition.y = Mathf.Clamp(newPosition.y, this.clampCameraY.x, this.clampCameraY.y);

        transform.position = newPosition;
    }
예제 #16
0
        private static MapInitJson GetMapInitJsonWithProjects(FocusArea focusArea, out bool hasSpatialData, Person currentPerson)
        {
            hasSpatialData = false;

            var layers = new List <LayerGeoJson>();

            if (focusArea.FocusAreaLocation != null)
            {
                hasSpatialData = true;
                layers.Add(new LayerGeoJson($"{FieldDefinition.FocusArea.GetFieldDefinitionLabel()} Location",
                                            focusArea.FocusAreaLocationToFeatureCollection(), "blue", 1,
                                            LayerInitialVisibility.Show));
            }

            var allActiveProjectsAndProposals = focusArea.GetAllActiveProjects(currentPerson).Where(x => x.ProjectStage.ShouldShowOnMap()).ToList();

            var projectsAsSimpleLocations = allActiveProjectsAndProposals.Where(x => x.ProjectLocationSimpleType != ProjectLocationSimpleType.None).ToList();
            var projectSimpleLocationsFeatureCollection = new FeatureCollection();

            var allProjectGrantAllocationExpenditures =
                HttpRequestStorage.DatabaseEntities.ProjectGrantAllocationExpenditures.ToList();
            var projectGrantAllocationExpenditureDict = allProjectGrantAllocationExpenditures.GroupBy(x => x.ProjectID).ToDictionary(x => x.Key, y => y.ToList());

            projectSimpleLocationsFeatureCollection.Features.AddRange(projectsAsSimpleLocations.Select(x =>
            {
                var feature = x.MakePointFeatureWithRelevantProperties(x.ProjectLocationPoint, true, true, FieldDefinition.Organization.GetFieldDefinitionLabel(), FieldDefinition.Organization.GetFieldDefinitionLabelPluralized(), projectGrantAllocationExpenditureDict);
                feature.Properties["FeatureColor"] = "#99b3ff";
                return(feature);
            }).ToList());

            if (projectSimpleLocationsFeatureCollection.Features.Any())
            {
                hasSpatialData = true;
                layers.Add(new LayerGeoJson("Projects", projectSimpleLocationsFeatureCollection, "yellow", 1, LayerInitialVisibility.Show));
            }

            var boundingBox = BoundingBox.MakeBoundingBoxFromLayerGeoJsonList(layers);

            return(new MapInitJson($"focusArea_{focusArea.FocusAreaID}_Map", 10, layers, boundingBox));
        }
예제 #17
0
    void LateUpdate()
    {
        FocusArea.Update(Target.Collider2D.bounds);

        Vector2 focusPosition = FocusArea.Centre + Vector2.up * VerticalOffset;

        if (FocusArea.Velocity.x != 0)
        {
            LookAheadDirX = Mathf.Sign(FocusArea.Velocity.x);
            if (Mathf.Sign(Target.PlayerInput.x) == Mathf.Sign(FocusArea.Velocity.x) && Target.PlayerInput.x != 0)
            {
                LookAheadStopped = false;
                TargetLookAheadX = LookAheadDirX * LookAheadDstX;
            }
            else
            {
                // If the player stopped moving in the X axis, the camera will stop the look ahead feature.
                if (!LookAheadStopped)
                {
                    LookAheadStopped = true;
                    TargetLookAheadX = CurrentLookAheadX + (LookAheadDirX * LookAheadDstX - CurrentLookAheadX) / 4f;
                }
            }
        }

        // Temp variable to store the SmoothDamp float, we assign it to the desired variable in the next few lines.
        float tempSLVX = SmoothLookVelocityX;

        CurrentLookAheadX   = Mathf.SmoothDamp(CurrentLookAheadX, TargetLookAheadX, ref tempSLVX, LookSmoothTimeX);
        SmoothLookVelocityX = tempSLVX;

        // Temp variable to store the SmoothDamp float, we assign it to the desired variable in the next few lines.
        float tempSVY = SmoothVelocityY;

        focusPosition.y = Mathf.SmoothDamp(transform.position.y, focusPosition.y, ref tempSVY, VerticalSmoothTime);
        SmoothVelocityY = tempSVY;

        focusPosition     += Vector2.right * CurrentLookAheadX;
        transform.position = (Vector3)focusPosition + Vector3.forward * -10;
    }
예제 #18
0
        void Start()
        {
            float focusAreaHalfWidth = focusAreaSize.x * 0.5f;

            _camera = GetComponent <Camera>();
            _camera.orthographicSize = (stopDistance + focusAreaHalfWidth) * _camera.scaledPixelHeight / _camera.scaledPixelWidth;


            float   cameraHalfWidth   = _camera.orthographicSize * _camera.aspect;
            Bounds  battleFieldBounds = _battleFieldModel.Bounds;
            float   maxWidth          = battleFieldBounds.size.x - 2 * (cameraHalfWidth + lookAheadDistance - focusAreaHalfWidth - cameraMargin);
            float   maxBoundsCenterY  = battleFieldBounds.max.y + maxWidth * 0.5f;
            Vector2 maxBoundsCenter   = new Vector2(battleFieldBounds.center.x, maxBoundsCenterY);
            Vector2 maxBoundsSize     = new Vector2(maxWidth, maxWidth);

            _focusArea = new FocusArea(
                focusAreaSize,
                new Bounds(maxBoundsCenter, maxBoundsSize),
                _hero.Bounds);

            _lookAheadStopped = true;
        }
예제 #19
0
        public async Task <ActionResult> Create([Bind(Include = "ID,FocusAreaName,FocusAreaDesc,OrganizationID,CreatedDate,isActive,TimeStamp,UserId")] FocusArea focusArea)
        {
            #region USERVALIDATION
            token = (string)(Session["accessToken"]);
            string userID = (string)(Session["UserID"]);
            #endregion
            if (ModelState.IsValid)
            {
                focusArea.CreatedDate = DateTime.Now;
                focusArea.UserId      = userID;
                focusArea.TimeStamp   = DateTime.Now;

                using (var client = new HttpClient())
                {
                    client.BaseAddress = new Uri(baseurl);
                    client.DefaultRequestHeaders.Clear();
                    client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
                    client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);

                    HttpResponseMessage Res = await client.PostAsJsonAsync("api/FocusAreas", focusArea);

                    if (Res.IsSuccessStatusCode)
                    {
                        this.AddNotification("Focus Area created successfully", NotificationType.SUCCESS);
                        return(RedirectToAction("Index"));
                    }
                    else
                    {
                        this.AddNotification("Focus Area cannot be created at this time. Please contact Administrator" + Res, NotificationType.ERROR);
                        return(View());
                    }
                }
            }
            ViewBag.OrganizationID = await OrganizationSelectListByModel(token, focusArea.OrganizationID);

            return(View(focusArea));
        }
예제 #20
0
        public async Task <ActionResult> Edit(int?id)
        {
            #region USERVALIDATION
            token = (string)(Session["accessToken"]);
            string userID = (string)(Session["UserID"]);
            #endregion
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            List <FocusArea> focusArea   = new List <FocusArea>();
            FocusArea        myFocusArea = new FocusArea();

            using (var client = new HttpClient())
            {
                client.BaseAddress = new Uri(baseurl);
                client.DefaultRequestHeaders.Clear();
                client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
                client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
                HttpResponseMessage Res = await client.GetAsync($"api/FocusAreas/{id}");

                if (Res.IsSuccessStatusCode)
                {
                    var focusAreaResponse = Res.Content.ReadAsStringAsync().Result;
                    myFocusArea = JsonConvert.DeserializeObject <FocusArea>(focusAreaResponse);
                }
                else
                {
                    this.AddNotification("Unable to display Focus Area information,please contact Administrator" + Res, NotificationType.ERROR);
                    return(View());
                }
            }
            ViewBag.OrganizationID = await OrganizationSelectListByModel(token, myFocusArea.OrganizationID);

            return(View(myFocusArea));
        }
예제 #21
0
 private void Start()
 {
     focusArea = new FocusArea(targetBounds, focusAreaSize);
 }
예제 #22
0
 public bool SetFocus()
 {
     ContentFocusedCommand?.Execute(this);
     return(FocusArea.Focus());
 }
예제 #23
0
 void Start()
 {
     zValue = transform.position.z;
     focusArea = new FocusArea(target.collider.bounds, focusAreaSize);
 }
예제 #24
0
 // Use this for initialization
 void Start()
 {
     focusArea = new FocusArea(target.collider.bounds, focusAreaSize);
 }
예제 #25
0
 void Start()
 {
     Cursor.visible = false;
     focusArea      = new FocusArea(target.collider.bounds, focusAreaSize);
 }
예제 #26
0
 // Use this for initialization
 void Start()
 {
     player    = GameObject.FindGameObjectWithTag("Player");
     cam       = GetComponent <Camera> ();
     focusArea = new FocusArea(player.GetComponent <Collider>().bounds, focusAreaSize);
 }
예제 #27
0
	void Start(){
		focusArea = new FocusArea (target, focusAreaSize);
	}
예제 #28
0
 void Start()
 {
     // Update the focusArea variable with the target's bounds and focusAreaSize.
     focusArea = new FocusArea(target.boxCollider.bounds, focusAreaSize);
 }
예제 #29
0
 void Start()
 {
     focusArea = new FocusArea (PlayerController.current.collider.bounds, focusAreaSize);
 }
예제 #30
0
    void Start()
    {
        targetBoxCollider = target.GetComponent<BoxCollider2D>();

        focusArea = new FocusArea (targetBoxCollider.bounds, focusAreaSize);
    }
예제 #31
0
 void Start()
 {
     _focusArea = new FocusArea(Target.Collider.bounds, FocusAreaSize);
 }
예제 #32
0
 public void SetTarget(Transform controller)
 {
     //Ошибка, когда спаунится игрок камера тут же прыгает на него. обходя ограничение по лимиту.
     target    = controller.GetComponent <BoxCollider2D>();
     focusArea = new FocusArea(target.bounds, focusAreaSize, limit);
 }
예제 #33
0
	// Use this for initialization
	void Start () {
		focusArea = new FocusArea (BoundsColliders(player), focusAreaSize);
	}
예제 #34
0
    void Start()
    {
        VerticalOffset = 1;

        LookAheadDstX = 4;

        LookSmoothTimeX = 0.5f;
        VerticalSmoothTime = 0.2f;

        FocusAreaSize = new Vector2(3,5);

        FocusArea = new FocusArea(Target.Collider2D.bounds, FocusAreaSize);
    }
예제 #35
0
 void Start()
 {
     focusArea    = new FocusArea(target.collider.bounds, focusAreaSize);
     alucard      = GameObject.Find("alucard");
     InputManager = alucard.GetComponent <Player.InputManager>();
 }
예제 #36
0
 public void Init()
 {
     targetCollider  = GameObject.FindWithTag("Player").GetComponent <Collider2D>();
     targetRigidBody = targetCollider.GetComponent <Rigidbody2D>();
     focusArea       = new FocusArea(targetCollider.GetComponent <Collider2D>().bounds, focusAreaSize);
 }
예제 #37
0
 void Start() {
   focusArea = new FocusArea (target.pc2d.box.bounds, focusAreaSize);
 }
예제 #38
0
 private void Start()
 {
     m_FocusArea       = new FocusArea(MainTarget.Collider.bounds, m_FocusAreaSize);
     m_TargetPositionX = MainTarget.transform.position.x;
 }
예제 #39
0
 void Start()
 {
     focusArea = new FocusArea(target.GetComponent<Collider2D>().bounds, focusAreaSize);
 }
예제 #40
0
 void Start()
 {
     focusArea = new FocusArea(target.p_pCalculator.GetBounds(), focusAreaSize);
 }
예제 #41
0
 void Start()
 {
     cameraFocusArea = new FocusArea(controller.collider.bounds, cameraFocusAreaSize);
 }
예제 #42
0
 void Start()
 {
     m_focusArea = new FocusArea(m_playerCol.bounds, m_focusAreaSize);
 }
예제 #43
0
 // Use this for initialization
 void Awake()
 {
     focusArea = new FocusArea (CharController.Instance.transform.GetComponent<CharacterController>().bounds, focusAreaSize);
     cameraEvent = 0;
     playerFocused = true;
     targetFocused = false;
     distanceAway = zoomDistance;
 }
예제 #44
0
    // Unity
    // =====================================================================

    private void Start()
    {
        _focusArea = new FocusArea(target.collider.bounds, focusAreaSize);
    }
예제 #45
0
	public void LateStart(){
		cam = GetComponent<Camera>();
		focusArea = new FocusArea (targets,ref focusAreaSize);
	}
예제 #46
0
 void Start()
 {
     focusArea = new FocusArea(target.colliders.bounds, focusAreaSize);
 }
예제 #47
0
 // Use this for initialization
 void Start()
 {
     focusArea = new FocusArea (CharController.Instance.transform.GetComponent<CharacterController>().bounds, focusAreaSize);
     cameraEvent = 0;
     playerFocused = true;
 }
예제 #48
0
 void Start()
 {
     focusArea = new FocusArea(target.GetComponent <BoxCollider2D>().bounds, focusAreaSize);
 }
예제 #49
0
	public void UpdateTarget () {
        target = GameObject.FindGameObjectWithTag("Player").GetComponent<Controller2D>();
        player = GameObject.FindGameObjectWithTag("Player").GetComponent<Player>();
        parallaxScrolling = GameObject.FindObjectOfType<ParallaxScrolling>().GetComponent<ParallaxScrolling>();
        focusArea = new FocusArea(target.boxCollider.bounds, focusAreaSize);
    }