Beispiel #1
0
        ////////////////

        private void GetCam01_PiratesArrive(IList <CameraMover> cams, Action onCamStop)
        {
            int lowExteriorShipViewX = this.Set.ExteriorTileLeft * 16;

            lowExteriorShipViewX += (this.Set.ExteriorDeckWidth + 24) * 16;
            int lowExteriorShipViewY = (int)this.Set.ExteriorShipView.Y;

            lowExteriorShipViewY += 8 * 16;
            int next = cams.Count;

            var cam = new CameraMover(
                name: "CutsceneLib_Intro_Pirates_" + cams.Count,
                moveXFrom: lowExteriorShipViewX,
                moveYFrom: lowExteriorShipViewY,
                moveXTo: (int)this.Set.ExteriorShipView.X,
                moveYTo: lowExteriorShipViewY,
                toDuration: 60 * 10,
                lingerDuration: 0,
                froDuration: 0,
                isSmoothed: true,
                onStop: () => {
                onCamStop?.Invoke();
                CameraMover.Current = cams[next + 1];
            }
                );

            cams.Add(cam);
        }
Beispiel #2
0
 protected PointSpawner(GameController input, GameUI ui, CameraMover camera, UnitType type)
     : base(input.Level, type)
 {
     this.input  = input;
     this.ui     = ui;
     this.camera = camera;
 }
        ////////////////

        private void GetCam01_ExteriorChat(
            IList <CameraMover> cams,
            Action onCamStop)
        {
            Vector2 exteriorShipView = this.Set.ExteriorShipView;
            int     next             = cams.Count;

            var cam = new CameraMover(
                name: "CutsceneLib_Intro_Setting_" + cams.Count,
                moveXFrom: (int)exteriorShipView.X,
                moveYFrom: (int)exteriorShipView.Y,
                moveXTo: (int)exteriorShipView.X,
                moveYTo: (int)exteriorShipView.Y - (12 * 16),
                toDuration: 60 * 3,
                lingerDuration: 60 * 3,
                froDuration: 0,
                isSmoothed: true,
                onStop: () => {
                onCamStop?.Invoke();
                CameraMover.Current = cams[next + 1];
            }
                );

            cams.Add(cam);
        }
Beispiel #4
0
    protected override void Action()
    {
        CameraMover cameraMover = Camera.main.GetComponent <CameraMover>();

        cameraMover.SetCameraPoint(cameraPoint);

        if (interfaceToEnable != null)
        {
            interfaceToEnable.SetActive(true);
            Clickable[] clickables = GetComponentsInChildren <Clickable>(true);
            foreach (Clickable clickable in clickables)
            {
                clickable.isSelected = false;
            }
        }
        if (interfaceToDisable != null)
        {
            Clickable[] clickables = GetComponentsInChildren <Clickable>(true);
            foreach (Clickable clickable in clickables)
            {
                clickable.isSelected = false;
            }
            interfaceToDisable.SetActive(false);
        }
        if (clickableToEnable != null)
        {
            clickableToEnable.enabled = true;
            clickableToEnable.Enable();
        }
        if (clickableToDisable != null)
        {
            clickableToDisable.Disable();
            clickableToDisable.enabled = false;
        }
    }
Beispiel #5
0
        ////////////////

        private void GetCam03_TBC(IList <CameraMover> cams, Action onCamStop)
        {
            int next   = cams.Count;
            int worldX = (Main.maxTilesX - 40) - (Main.screenWidth / 16);

            worldX *= 16;
            int worldY = 40 * 16;

            var cam = new CameraMover(
                name: "CutsceneLib_Intro_Pirates_" + cams.Count,
                moveXFrom: worldX,
                moveYFrom: worldY,
                moveXTo: worldX,
                moveYTo: worldY,
                toDuration: 0,
                lingerDuration: 60 * 5,
                froDuration: 0,
                isSmoothed: false,
                onStop: () => {
                onCamStop?.Invoke();
                //CameraMover.Current = cams[next + 1];
            }
                );

            cams.Add(cam);
        }
Beispiel #6
0
        protected override void Awake()
        {
            base.Awake();

            this.WindowTexture = GetComponent <WindowTextureManager>();
            this.SkyScraper    = GetComponent <SkyscraperManager>();
            this.Roads         = GetComponent <RoadsManager>();
            this.Cars          = GetComponent <CarsManager>();
            this.Decoration    = GetComponent <DecorationManager>();
            this.Sky           = GetComponent <SkyManager>();

            this.mover       = this.mover ?? Camera.main.GetComponent <CameraMover>();
            this.load        = this.load ?? Camera.main.GetComponent <Load>();
            this.buildScaler = this.buildScaler ?? FindObjectOfType <BuildScaler>();

            this.initializes = new List <Action>()
            {
                () => this.Sky.Initialize(),
                () => this.WindowTexture.Initialize(0),
                () => this.WindowTexture.Initialize(1),
                () => this.WindowTexture.Initialize(2),
                () => this.WindowTexture.Initialize(3),
                () => this.SkyScraper.Initialize(this.WindowTexture, this.Sky),
                () => this.buildScaler.Initialize(this.SkyScraper),
                () => this.Roads.Initialize(this.SkyScraper),
                () => this.Cars.Initialize(this.SkyScraper),
                () => this.Decoration.Initialize(this.SkyScraper),
                () => this.mover.Initialize(this.SkyScraper)
            };

            StartCoroutine(this.Initialize());
        }
Beispiel #7
0
 public UIMinimap(Button minimapButton, GameUI uiManager, CameraMover cameraMover, ILevelManager level)
     : base(minimapButton, cameraMover, level)
 {
     this.uiManager            = uiManager;
     InputCtl.MouseWheelMoved += MouseWheel;
     controllingMovement       = false;
 }
Beispiel #8
0
 public DynamicSizeHighlighter(GameController input, GameUI ui, CameraMover camera)
     : base(input)
 {
     this.input  = input;
     this.ui     = ui;
     this.camera = camera;
 }
Beispiel #9
0
        public KeepBuilder(GameController input, GameUI ui, CameraMover camera, KeepType type)
            : base(input, ui, camera, type.MyTypeInstance, Cost.Free)
        {
            AbleFront = Color.Blue;

            cwUI = new BaseCustomWindowUI(ui, type.Name, "");
        }
Beispiel #10
0
 public Deleter(GameController input, GameUI ui, CameraMover camera)
     : base(input.Level, new DeleteUnitType())
 {
     this.input  = input;
     this.ui     = ui;
     this.camera = camera;
 }
Beispiel #11
0
 private void Awake()
 {
     if (!_camera)
     {
         _camera = Camera.main.GetComponent <CameraMover>();
     }
 }
Beispiel #12
0
        public TileTypeTool(GameController input, GameUI ui, CameraMover camera, IntRect iconRectangle)
            : base(input, iconRectangle)
        {
            this.input           = input;
            this.ui              = ui;
            this.tileTypes       = new Dictionary <CheckBox, TileType>();
            this.highlight       = new StaticSizeHighlighter(input, ui, camera, 3, Color.Green);
            this.checkBoxes      = new ExclusiveCheckBoxes();
            this.mouseButtonDown = false;
            this.enabled         = false;
            InitUI(ui, out uiElem, out sizeSlider);

            foreach (var tileType in input.Level.Package.TileTypes)
            {
                var checkBox = ui.SelectionBar.CreateCheckBox();
                checkBox.SetStyle("SelectionBarCheckBox");
                checkBox.Toggled      += OnTileTypeToggled;
                checkBox.Texture       = input.Level.Package.TileIconTexture;
                checkBox.ImageRect     = tileType.IconRectangle;
                checkBox.HoverOffset   = new IntVector2(tileType.IconRectangle.Width(), 0);
                checkBox.CheckedOffset = new IntVector2(2 * tileType.IconRectangle.Width(), 0);

                tileTypes.Add(checkBox, tileType);
                checkBoxes.AddCheckBox(checkBox);
            }
        }
Beispiel #13
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetMouseButtonDown(0))
        {
            Ray mRay = mCamera.ScreenPointToRay(Input.mousePosition);

            RaycastHit hit;

            if (Physics.Raycast(mRay, out hit))
            {
                if (hit.collider.gameObject.tag == "Node")
                {
                    Node node = hit.collider.GetComponent <Node>();

                    CameraMover cameraMover = CameraMover.instance;

                    Debug.Log("Hit");

                    foreach (var item in NodeCtr.instance.nodes)
                    {
                        item.TurnOffCollider();
                    }

                    int num = NodeCtr.instance.nodes.IndexOf(node);

                    // CanvasCtr.instance.ShowAll(num);

                    cameraMover.MoveCameraToPos(node);
                }
            }
        }
    }
Beispiel #14
0
        ////////////////

        private void GetCam02_Dungeon(IList <CameraMover> cams, Action onCamStop)
        {
            bool isShipOnLeft = (int)this.Set.ExteriorShipView.X < ((16 * Main.maxTilesX) / 2);
            var  dungeonView  = new Vector2(Main.dungeonX * 16, Main.dungeonY * 16);

            dungeonView.X += isShipOnLeft
                                ? 0
                                : (32 * 16);
            //dungeonView.Y += -32 * 16;

            int next = cams.Count;

            var cam = new CameraMover(
                name: "CutsceneLib_Intro_Setting_" + cams.Count,
                moveXFrom: (int)dungeonView.X,
                moveYFrom: (int)dungeonView.Y,
                moveXTo: (int)dungeonView.X,
                moveYTo: (int)dungeonView.Y - (4 * 16),
                toDuration: 60 * 5,
                lingerDuration: 0,
                froDuration: 0,
                isSmoothed: false,
                onStop: () => {
                onCamStop?.Invoke();
                //CameraMover.Current = cams[next + 1];
            }
                );

            cams.Add(cam);
        }
Beispiel #15
0
 void Awake()
 {
     rigidbody            = GetComponent <Rigidbody2D>();
     defaultGrabvityScale = rigidbody.gravityScale;
     inputProvider        = GetComponent <PlayerInputProvider>();
     cameraMover          = GameObject.Find("Main Camera").GetComponent <CameraMover>();
 }
 public TerrainSmoothingManipulator(GameController input, GameUI ui, CameraMover camera, IMap map)
 {
     this.input = input;
     this.ui    = ui;
     this.map   = map;
     InitUI(ui, out uiElem, out sizeSlider);
     highlight = new StaticSizeHighlighter(input, ui, camera, 3, Color.Green);
 }
Beispiel #17
0
 private void Awake()
 {
     if (instance != null)
     {
         return;
     }
     instance = this;
 }
Beispiel #18
0
 public TreeCutterBuilder(GameController input,
                          GameUI ui,
                          CameraMover camera,
                          TreeCutterType type)
     : base(input, ui, camera, type.MyTypeInstance, input.Level.EditorMode ? Cost.Free : type.Cost)
 {
     cwUI = new BaseCustomWindowUI(ui, type.Name, $"Cost: {type.Cost}");
 }
Beispiel #19
0
        private void Update()
        {
            Vector3 screenPoint = CameraMover.instance().mainCamera.WorldToViewportPoint(this.transform.position);
            // If the screen point is less than 0 or greater than 1, hide the light.
            bool onScreen = screenPoint.z > 0 && screenPoint.x > 0 && screenPoint.x < 1 && screenPoint.y > 0 && screenPoint.y < 1;

            this.lightComponent.enabled = onScreen;
        }
Beispiel #20
0
 public DirectionlessBuilder(GameController input, GameUI ui, CameraMover camera, BuildingType type, Cost cost)
     : base(input.Level, type)
 {
     this.Input  = input;
     this.Ui     = ui;
     this.Camera = camera;
     this.cost   = cost;
 }
Beispiel #21
0
        public GateBuilder(GameController input, GameUI ui, CameraMover camera, GateType type)
            : base(input, ui, camera, type.MyTypeInstance, input.Level.EditorMode ? Cost.Free : type.Cost)
        {
            AbleFront = Color.Red;
            AbleBack  = Color.Yellow;

            cwUI = new BaseCustomWindowUI(ui, type.Name, $"Cost: {type.Cost}");
        }
Beispiel #22
0
 public override void Start()
 {
     speed       = CameraMover.instance.moveSpeed;
     targetSpeed = Mathf.Lerp(easySpeed, hardSpeed, difficulty);
     CameraMover.LockSpeed(speed);
     speedParticleSystem.Play();
     Score.scoreCoef = 3f;
 }
Beispiel #23
0
    public void MoveRight()
    {
        CameraMover cameraMover = CameraMover.instance;

        cameraMover.CurrentNodeNum++;
        cameraMover.MoveCameraToPos(NodeCtr.instance.nodes[cameraMover.CurrentNodeNum]);
        //   UpdateBtn(cameraMover.CurrentNodeNum);
    }
Beispiel #24
0
 void Start()
 {
     player      = FindObjectOfType <PlayerController>();
     scoreBoard  = FindObjectOfType <ScoreBoard>();
     cameraMover = FindObjectOfType <CameraMover>();
     baseHealthSlider.maxValue = baseMaxHealth;
     currentBaseHealth         = baseMaxHealth;
 }
 private void Awake()
 {
     _playerController  = FindObjectOfType <PlayerController>();
     _cameraMover       = new CameraMover(this);
     _camOldPos         = transform.position;
     _camOldRotation    = transform.rotation;
     CameraFollowOffset = Mathf.Abs(_playerController.transform.position.z - transform.position.z);
 }
Beispiel #26
0
 public StaticSizeHighlighter(GameController input, GameUI ui, CameraMover camera, int edgeSize, Color color)
     : base(input)
 {
     this.ui       = ui;
     this.input    = input;
     this.camera   = camera;
     this.EdgeSize = edgeSize;
     this.color    = color;
 }
 // Start is called before the first frame update
 void Awake()
 {
     chaser        = FindObjectOfType <Chaser>();
     chaserPointer = FindObjectOfType <ChaserPointer>();
     chaserPointer.GetComponent <FixedJoint2D>().connectedBody = chaser.GetComponent <Rigidbody2D>();
     lar         = FindObjectOfType <LaunchArcRenderer>();
     audioSource = GetComponent <AudioSource>();
     cameraMover = FindObjectOfType <CameraMover>();
 }
Beispiel #28
0
        public Destroyer(GameController input, GameUI ui, CameraMover camera)
            : base(input.Level, new DestroyBuildingType())
        {
            this.Input  = input;
            this.Ui     = ui;
            this.Camera = camera;

            cwUI = new BaseCustomWindowUI(ui, "Demolish buildings", "");
        }
Beispiel #29
0
        void MouseMove(MHUrhoMouseMovedEventArgs args)
        {
            Vector2 newMovement = (Button.ScreenToElement(args.CursorPosition) - MinimapClickPos).ToVector2();

            newMovement.Y = -newMovement.Y;
            CameraMover.SetStaticHorizontalMovement(CameraMover.StaticHorizontalMovement + (newMovement - PreviousCameraMovement));

            PreviousCameraMovement = newMovement;
        }
Beispiel #30
0
 // Start is called before the first frame update
 void Start()
 {
     _cameraMover = _battleManager.CameraMover;
     _cursor      = _battleManager.Cursor;
     ActionMenuInput.SetupDependecies(_battleManager, this, _unitToAttackInput);
     MovementInput.SetupDependecies(_battleManager, this);
     _unitToAttackInput.SetupDependecies(_battleManager, this, _combatManager);
     GeneralMenuInput.SetupDependecies(_battleManager, this, _unitToAttackInput);
 }
    void Awake()
    {
        S = this;
        cam = transform.Find("Main Camera");
        p0 = cam.localPosition;
        Transform t = transform.Find("CamEnd");
        p1 = t.localPosition;

        Time.timeScale = 0;

        startRY = transform.rotation.eulerAngles.y;
    }
 // Use this for initialization
 void Awake()
 {
     soldierController = gameObject.GetComponent<SoldierManager>();
     cameraMover = Camera.main.GetComponent<CameraMover>();
     upgradeManager = GameObject.FindObjectOfType<UpgradeManager>().GetComponent<UpgradeManager>();
 }