public void Damage()
 {
     if (buildStatus < buildMax)
     {
         buildStatus      = 0;
         gameObject.layer = unbuiltLayer;
         animator.SetInteger("buildState", buildStatus);
         animator.SetTrigger("death");
         CameraDirector.ScreenShake(0.5f);
     }
     else
     {
         CameraDirector.Danger(transform.position.y);
         CameraDirector.ScreenShake(0.5f);
         if (damageState)
         {
             Kill();
         }
         else
         {
             damageState = true;
             animator.SetTrigger("damage");
         }
     }
 }
 void Start()
 {
     verticalTarget    = transform.position.y;
     verticalTargetMin = transform.position.y;
     verticalTargetMax = transform.position.y + 5.0f;
     instance          = this;
 }
Exemplo n.º 3
0
        protected override void OnClick(UIMouseEventParameter p)
        {
            if (p.buttons.IsFlagSet(UIMouseButton.Left))
            {
                CameraDirector.ToggleUI();
            }

            base.OnClick(p);
        }
Exemplo n.º 4
0
 private void SetInitialVariables()
 {
     actualMovState = CharacterMovementState.Idle;
     pJumpState     = CharacterJumpState.Grounded;
     cDirector      = FindObjectOfType <CameraDirector>();
     playerSizeX    = SetPlayersizeX();
     playerSizeY    = SetPlayerSizeY();
     groundDistance = playerSizeY / 2 + .02f;
     maxXSpeed      = initialMaxSpeed;
 }
Exemplo n.º 5
0
    static public void Populate(float x, float y, int i)
    {
        TowerBlock block = WorldGetBlock(x, y);

        if (block == null)
        {
            block      = Instantiate(instance.blockPrefab, new Vector3(x, y, 0.0f), Quaternion.identity) as TowerBlock;
            block.hpos = i;
            instance.towerBlocks.Add(block);
            instance.highest = y;
            CameraDirector.SetNewMax(instance.highest);
        }
    }
Exemplo n.º 6
0
    // Use this for initialization
    void Start()
    {
        anchorCrane = null;
        anchorCam   = null;

        CheckCamera();
        CreateAnchors();

        prevCameraType = cameraType.ToString();

        cameraDirector = GameObject.FindGameObjectWithTag("Director").GetComponent <CameraDirector>();
        cameraDirector.RegisterCamera(gameObject);
    }
Exemplo n.º 7
0
    private void Awake()
    {
        Camera thisCam = this.GetComponent <Camera>();

        if (CameraDirector.IsLoaded)
        {
            thisCam.enabled = false;

            this.GetComponent <AudioListener>().enabled    = false;
            this.GetComponent <CinemachineBrain>().enabled = false;
            CameraDirector.CutTo(transform);
            gameObject.SetActive(false);
            this.tag = "Untagged";
        }
        else
        {
            var controller = gameObject.AddComponent <MouseController>();
            controller.clickables = LayerMask.GetMask("Walkable", "Interactable");
            controller.cam        = thisCam;
            this.tag = "MainCamera";
        }
    }
Exemplo n.º 8
0
        SceneCaller InitSceneCaller()
        {
            CameraDirector cameraDirector = new CameraDirector(
                ConstCamera.EnumerateStudios());

            CanvasDirector canvasDirector = new CanvasDirector(
                ConstStratum.EnumerateStrata(),
                uiCameraGenerator,
                cameraDirector);

            SceneDirector.Instance.Init(LoadSceneFromAssetBundle);
            SceneLoader sceneLoader = new SceneLoader(SceneDirector.Instance);

            BackgroundUiDirector.Instance.Init(canvasDirector);
            CoreUiDirector.Instance.Init(sceneLoader, canvasDirector);
            ResidentUiDirector.Instance.Init(canvasDirector);
            PopupUiDirector.Instance.Init(canvasDirector);
            OverlayUiDirector.Instance.Init(sceneLoader, canvasDirector);
            FrontmostUiDirector.Instance.Init(canvasDirector);

            return(new SceneCaller(sceneLoader));
        }
Exemplo n.º 9
0
    private static GameDirector gameDirector;      //シングルトン


    void Start()
    {
        if (ui_Director == null)
        {
            Debug.Log("ui_Directorがnull");
        }
        if (playerDirector == null)
        {
            Debug.Log("player_Directorがnull");
        }
        if (bossDirector == null)
        {
            Debug.Log("boss_Directorがnull");
        }
        if (animDirector == null)
        {
            Debug.Log("anim_Directorがnull");
        }

        enemyDirectors = new List <EnemyDirector>();
        otherDirectors = new List <OtherDirector>();
        cameraDirector = Camera.main.GetComponent <CameraDirector>();
        charaFreeze    = GetComponent <CharacterFreeze>();
        cameraFreeze   = GetComponent <CameraFreeze>();
        otherFreeze    = GetComponent <OtherFreeze>();
        audioDirector  = Camera.main.GetComponent <AudioDirector>();
        gameDirector   = this;

        canDoDirector      = true;
        isWeaponFreezed    = false;
        weaponStateMachine = playerDirector.GetComponentInChildren <WeaponStateMachine>();

        freezeCount = 0;
        freezeList  = new List <GameObject>();
        isPaused    = false;

        Application.targetFrameRate = 60;
    }
 void Awake()
 {
     main = this;
     main.camera.eventMask = 1 << LayerMask.NameToLayer("Reading");
     Mouse.Override(Mouse.Mode.ZoomOut);
 }
    void Update()
    {
        if (Tower.gameOver)
        {
            return;
        }
        dy = py - Input.mousePosition.y;
        py = Input.mousePosition.y;

        if (Input.GetMouseButtonUp(0))
        {
            endPos = new Vector2(Input.mousePosition.x, Input.mousePosition.y);
            if (scrollmode)
            {
                scrollmode = false;
            }
            if (swipeDown)
            {
                float deltax = (startPos.x - endPos.x);
                float deltay = (startPos.y - endPos.y);
                if (Mathf.Abs(deltax) > Mathf.Abs(deltay))
                {
                    if (Mathf.Abs(deltax) > swipeDistance)
                    {
                        if (Mathf.Sign(deltax) > 0)
                        {
                            blockSelector.Swipe(3); //left
                        }
                        else
                        {
                            blockSelector.Swipe(1); //right
                        }
                    }
                }
                else
                {
                    if (Mathf.Abs(deltay) > swipeDistance)
                    {
                        if (Mathf.Sign(deltay) > 0)
                        {
                            blockSelector.Swipe(2); //down
                        }
                        else
                        {
                            blockSelector.Swipe(0); //up
                        }
                    }
                }
                swipeDown = false;
            }
        }
        else if (Input.GetMouseButtonDown(0))
        {
            scrollmode = !blockSelector.NewPosition(Input.mousePosition.x, Input.mousePosition.y);
            swipeDown  = !scrollmode;
            startPos   = new Vector2(Input.mousePosition.x, Input.mousePosition.y);
        }
        else if (scrollmode && Input.GetMouseButton(0))
        {
            float adjusted = dy;
            if (Application.platform == RuntimePlatform.Android)
            {
                adjusted *= 0.03f;
                float sign = Mathf.Sign(adjusted);
                adjusted *= adjusted * sign;
            }
            CameraDirector.MoveDelta(adjusted);
        }
    }
Exemplo n.º 12
0
	void Start ()
    {
        _this = this;
	}
Exemplo n.º 13
0
 private void Awake()
 {
     Instance = this;
 }
 //初期化関数
 void Start()
 {
     cameraDire = Camera.main.GetComponent <CameraDirector>();
     status     = GetComponent <BossStatus>();
     first      = true;
 }
Exemplo n.º 15
0
 //初期化処理関数
 void Start()
 {
     cameraOb       = GetComponent <CameraObserver>();
     cameraDirector = Camera.main.GetComponent <CameraDirector>();
     isPlayer       = false;
 }
        public override void Start()
        {
            name             = "CCX_MainWindow";
            atlas            = UIUtils.GetAtlas("Ingame");
            backgroundSprite = "SubcategoriesPanel";
            size             = new Vector2(465, 180);
            isVisible        = false;

            UIDragHandle dragHandle = AddUIComponent <UIDragHandle>();

            dragHandle.target           = parent;
            dragHandle.relativePosition = Vector3.zero;

            UIButton close = AddUIComponent <UIButton>();

            close.size             = new Vector2(30f, 30f);
            close.text             = "X";
            close.textScale        = 0.9f;
            close.textColor        = new Color32(118, 123, 123, 255);
            close.focusedTextColor = new Color32(118, 123, 123, 255);
            close.hoveredTextColor = new Color32(140, 142, 142, 255);
            close.pressedTextColor = new Color32(99, 102, 102, 102);
            close.textPadding      = new RectOffset(8, 8, 8, 8);
            close.canFocus         = false;
            close.playAudioEvents  = true;
            close.relativePosition = new Vector3(width - close.width, 0);

            close.eventClicked += (c, p) =>
            {
                if (isVisible)
                {
                    CameraDirector.ToggleUI();
                }
            };

            // Control panel
            UILabel label = AddUIComponent <UILabel>();

            label.textScale        = 0.9f;
            label.text             = "Cinematic Camera Extended";
            label.relativePosition = new Vector2(8, 8);
            label.SendToBack();

            UIPanel controlPanel = AddUIComponent <UIPanel>();

            controlPanel.atlas            = atlas;
            controlPanel.backgroundSprite = "GenericPanel";
            controlPanel.color            = new Color32(206, 206, 206, 255);
            controlPanel.size             = new Vector2(width - 16, 46);
            controlPanel.relativePosition = new Vector2(8, 28);

            addKnotButton                  = UIUtils.CreateButton(controlPanel);
            addKnotButton.name             = "CCX_AddKnot";
            addKnotButton.textScale        = 1.5f;
            addKnotButton.text             = "+";
            addKnotButton.size             = new Vector2(40f, 30f);
            addKnotButton.relativePosition = new Vector3(8, 8);
            addKnotButton.tooltip          = "Add a new point to the path";

            playButton                  = UIUtils.CreateButton(controlPanel);
            playButton.name             = "CCX_Play";
            playButton.textScale        = 1.5f;
            playButton.text             = ">";
            playButton.size             = new Vector2(40f, 30f);
            playButton.playAudioEvents  = false;
            playButton.relativePosition = new Vector3(controlPanel.width - playButton.width - 8, 8);
            playButton.tooltip          = "Play the current path";

            playSpeedDropDown       = UIUtils.CreateDropDown(controlPanel);
            playSpeedDropDown.width = 75;
            playSpeedDropDown.items = new string[]
            {
                "x 1/16",
                "x 1/8",
                "x 1/4",
                "x 1/2",
                "x 1",
                "x 2",
                "x 4",
                "x 8",
                "x 16"
            };
            playSpeedDropDown.selectedValue    = "x 1";
            playSpeedDropDown.relativePosition = new Vector3(playButton.relativePosition.x - playSpeedDropDown.width - 8, 8);
            playSpeedDropDown.tooltip          = "Playback speed";

            timelineSlider                  = controlPanel.AddUIComponent <UISlider>();
            timelineSlider.name             = "CCX_TimelineSlider";
            timelineSlider.size             = new Vector2(playSpeedDropDown.relativePosition.x - addKnotButton.relativePosition.x - addKnotButton.width - 20, 18);
            timelineSlider.relativePosition = new Vector2(addKnotButton.relativePosition.x + addKnotButton.width + 10, 14);

            UISlicedSprite bgSlider = timelineSlider.AddUIComponent <UISlicedSprite>();

            bgSlider.atlas            = atlas;
            bgSlider.spriteName       = "BudgetSlider";
            bgSlider.size             = new Vector2(timelineSlider.width, 9);
            bgSlider.relativePosition = new Vector2(0, 4);
            bgSlider.tooltip          = "Drag the slider to preview the animation";

            UISlicedSprite thumb = timelineSlider.AddUIComponent <UISlicedSprite>();

            thumb.atlas                = atlas;
            thumb.spriteName           = "SliderBudget";
            timelineSlider.thumbObject = thumb;

            timelineSlider.minValue = 0f;
            timelineSlider.maxValue = 1f;
            timelineSlider.stepSize = 0;
            timelineSlider.value    = 0;

            // FOV panel
            UIPanel fovPanel = AddUIComponent <UIPanel>();

            fovPanel.atlas            = atlas;
            fovPanel.backgroundSprite = "GenericPanel";
            fovPanel.color            = new Color32(206, 206, 206, 255);
            fovPanel.size             = new Vector2(width - 120 - 8 * 3, 46);
            fovPanel.relativePosition = new Vector2(8, controlPanel.relativePosition.y + controlPanel.height + 8);

            label                   = fovPanel.AddUIComponent <UILabel>();
            label.textScale         = 0.9f;
            label.text              = "Fov:";
            label.autoSize          = false;
            label.height            = 30;
            label.verticalAlignment = UIVerticalAlignment.Middle;
            label.relativePosition  = new Vector2(8, 8);

            fovInput                  = UIUtils.CreateTextField(fovPanel);
            fovInput.name             = "CCX_MainFovInput";
            fovInput.size             = new Vector2(45f, 26);
            fovInput.text             = (2f * CameraDirector.camera.fieldOfView).ToString();
            fovInput.numericalOnly    = true;
            fovInput.allowFloats      = true;
            fovInput.padding.top      = 6;
            fovInput.relativePosition = new Vector3(fovPanel.width - fovInput.width - 8, 10);
            fovInput.tooltip          = "Field of view in degrees";

            fovSlider                  = fovPanel.AddUIComponent <UISlider>();
            fovSlider.name             = "CCX_TimelineSlider";
            fovSlider.size             = new Vector2(fovInput.relativePosition.x - label.relativePosition.x - label.width - 20, 18);
            fovSlider.relativePosition = new Vector2(label.relativePosition.x + label.width + 10, 14);

            bgSlider                  = fovSlider.AddUIComponent <UISlicedSprite>();
            bgSlider.atlas            = atlas;
            bgSlider.spriteName       = "BudgetSlider";
            bgSlider.size             = new Vector2(fovSlider.width, 9);
            bgSlider.relativePosition = new Vector2(0, 4);
            bgSlider.tooltip          = "Drag the slider to change the field of view";

            thumb                 = fovSlider.AddUIComponent <UISlicedSprite>();
            thumb.atlas           = atlas;
            thumb.spriteName      = "SliderBudget";
            fovSlider.thumbObject = thumb;

            fovSlider.minValue = 20f;
            fovSlider.maxValue = 179f;
            fovSlider.stepSize = 1f;
            fovSlider.value    = CameraDirector.camera.fieldOfView * 2f;

            // FPS panel
            UIPanel fpsPanel = AddUIComponent <UIPanel>();

            fpsPanel.atlas            = atlas;
            fpsPanel.backgroundSprite = "GenericPanel";
            fpsPanel.color            = new Color32(206, 206, 206, 255);
            fpsPanel.size             = new Vector2(120, 46);
            fpsPanel.relativePosition = new Vector2(fovPanel.relativePosition.x + fovPanel.width + 8, fovPanel.relativePosition.y);

            fpsInput                  = UIUtils.CreateTextField(fpsPanel);
            fpsInput.name             = "CCX_FpsInput";
            fpsInput.size             = new Vector2(45f, 26);
            fpsInput.text             = CameraDirector.fps.ToString();
            fpsInput.numericalOnly    = true;
            fpsInput.allowFloats      = true;
            fpsInput.padding.top      = 6;
            fpsInput.relativePosition = new Vector3(fpsPanel.width - fpsInput.width - 8, 10);
            fpsInput.tooltip          = "Fps";
            fpsInput.tooltip          = "Sync the camera and the simulation at a set frame rate";

            fpsCheckBox                  = UIUtils.CreateCheckBox(fpsPanel);
            fpsCheckBox.text             = "Fps:";
            fpsCheckBox.isChecked        = false;
            fpsCheckBox.width            = fpsPanel.width - fpsInput.width - 24;
            fpsCheckBox.relativePosition = new Vector2(8, 16);
            fpsCheckBox.tooltip          = "Sync the camera and the simulation at a set frame rate";

            // Hide UI checkbox
            hideUICheckBox                  = UIUtils.CreateCheckBox(this);
            hideUICheckBox.name             = "CCX_HideUICheckBox";
            hideUICheckBox.text             = "Hide UI during playback";
            hideUICheckBox.isChecked        = true;
            hideUICheckBox.width            = width - 16;
            hideUICheckBox.relativePosition = new Vector2(8, fovPanel.relativePosition.y + fovPanel.height + 8);

            // Start simulation checkbox
            startSimCheckBox                  = UIUtils.CreateCheckBox(this);
            startSimCheckBox.name             = "CCX_StartSimCheckBox";
            startSimCheckBox.text             = "Unpause simulation";
            startSimCheckBox.isChecked        = false;
            startSimCheckBox.width            = (width - 16) / 2;
            startSimCheckBox.relativePosition = new Vector2(8, hideUICheckBox.relativePosition.y + hideUICheckBox.height + 8);

            // FastList
            fastList = UIFastList.Create <UIKnotsListRow>(this);
            fastList.backgroundSprite = "UnlockingPanel";
            fastList.width            = width - 16;
            fastList.height           = 46 * 5;
            fastList.canSelect        = true;
            fastList.relativePosition = new Vector3(8, startSimCheckBox.relativePosition.y + startSimCheckBox.height + 8);

            fastList.rowHeight = 46f;
            fastList.rowsData  = CameraDirector.cameraPath.knots;

            // Load/Save
            saveLoadButton                  = UIUtils.CreateButton(this);
            saveLoadButton.name             = "CCX_SaveLoadButton";
            saveLoadButton.text             = "Save/Load";
            saveLoadButton.size             = new Vector2(100f, 30f);
            saveLoadButton.relativePosition = new Vector3(width - saveLoadButton.width - 8, fastList.relativePosition.y + fastList.height + 8);
            saveLoadButton.tooltip          = "Work in progress";

            height           = saveLoadButton.relativePosition.y + saveLoadButton.height + 8;
            dragHandle.size  = size;
            absolutePosition = new Vector3(savedWindowX.value, savedWindowY.value);
            MakePixelPerfect();

            addKnotButton.eventClicked += (c, p) =>
            {
                int i = CameraDirector.cameraPath.AddKnot();
                fastList.DisplayAt(i);

                timelineSlider.minValue = 0f;
                float duration = CameraDirector.cameraPath.CalculateTotalDuraction();
                if (duration <= 0f)
                {
                    duration = 1f;
                }
                timelineSlider.maxValue = duration;
            };

            playButton.eventClicked += (c, p) =>
            {
                CameraDirector.cameraPath.Play();
            };

            timelineSlider.eventMouseDown += (c, p) =>
            {
                CameraPath.currentTransfrom = new Knot();
            };

            timelineSlider.eventValueChanged += (c, p) =>
            {
                CameraDirector.cameraPath.SetToTime(p);
            };

            hideUICheckBox.eventCheckChanged += (c, p) =>
            {
                CameraDirector.freeCamera = p;
            };

            startSimCheckBox.eventCheckChanged += (c, p) =>
            {
                CameraDirector.startSimulation = p;
            };

            fovSlider.eventValueChanged += (c, p) =>
            {
                CameraDirector.camera.fieldOfView = p / 2f;
                fovInput.text = p.ToString();
            };

            fovInput.eventTextSubmitted += (c, p) =>
            {
                float value;
                if (float.TryParse(p, out value))
                {
                    CameraDirector.camera.fieldOfView = Mathf.Clamp(value, 20f, 179f) / 2f;

                    if (fovSlider.value != value)
                    {
                        fovSlider.value = value;
                    }
                }

                fovInput.text = (2f * CameraDirector.camera.fieldOfView).ToString();
            };

            fovInput.eventMouseWheel += (c, p) =>
            {
                if (!p.used)
                {
                    fovSlider.value += p.wheelDelta;
                    p.Use();
                }
            };

            fpsCheckBox.eventCheckChanged += (c, p) =>
            {
                CameraDirector.useFps = p;
            };

            fpsInput.eventTextSubmitted += (c, p) =>
            {
                float value;
                if (float.TryParse(p, out value))
                {
                    CameraDirector.fps = Mathf.Max(0, value);
                }

                fpsInput.text = CameraDirector.fps.ToString();
            };

            fpsInput.eventMouseWheel += (c, p) =>
            {
                if (!p.used)
                {
                    CameraDirector.fps = Mathf.Max(0, CameraDirector.fps + p.wheelDelta);
                    fpsInput.text      = CameraDirector.fps.ToString();
                    p.Use();
                }
            };

            saveLoadButton.eventClicked += (c, p) =>
            {
                if (saveLoadWindow == null)
                {
                    saveLoadWindow = (UISaveLoadWindow)GetUIView().AddUIComponent(typeof(UISaveLoadWindow));
                }
                else
                {
                    Destroy(saveLoadWindow);
                }
            };

            DebugUtils.Log("UIMainWindow created");
        }