Inheritance: MonoBehaviour
Exemplo n.º 1
0
    public void OpenOrCloseMenuButton()
    {
        // Initialize toon
        if (toon == null)
        {
            GameObject camera = GameObject.FindGameObjectWithTag("MainCamera");
            toon          = camera.GetComponent <CameraToon>();
            movableCamera = camera.GetComponent <MovableCamera>();
            player        = GameObject.FindGameObjectWithTag("Player").transform;

            animator = GetComponent <Animator>();               // In base menu class
        }

        // Throw if shader running or menu opening/closing
        if (toon.GetOn() || MenuOpenningOrClosing())
        {
            return;
        }

        open = !open;           // switch open state
        if (open)
        {
            gameObject.SetActive(true);                 // if inactive active first
        }
        StartCoroutine("OpenOrCloseMenuAction", false); // open or close menu
    }
Exemplo n.º 2
0
    void Awake()
    {
        // Time button
        cameraGrey             = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <CameraGrey>();                         // shader
        stoppableObjectManager = GameObject.FindGameObjectWithTag("StoppableObjectManager").GetComponent <StoppableObjectManager>(); // manager
        timeGUI = Resources.FindObjectsOfTypeAll <TimeGUI>()[0] as TimeGUI;

        // Animation
        spriteRenderer = GetComponent <SpriteRenderer>(); // Sprite flip X
        rb             = GetComponent <Rigidbody2D>();    // physics
        animator       = GetComponent <Animator>();       // Animator

        // Item collection
        bag = GetComponent <Bag>();

        // Bonus room
        movableCamera = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <MovableCamera>();
        countDown     = Resources.FindObjectsOfTypeAll <CountDown>()[0] as CountDown;

        // Falling
        gravity       = Physics.gravity.y;              // fall force
        boxCollider2D = GetComponent <BoxCollider2D>(); // raycast width
        sceneHeight   = GameObject.FindGameObjectWithTag("OuterBorder").GetComponent <OuterBorder>().BorderHeight();

        // Sound play
        // soundManager = GameObject.FindGameObjectWithTag("SoundManager").GetComponent<SoundManager>();
        soundManager = GetComponent <SoundManager>();
    }
Exemplo n.º 3
0
    public void FocusOnPoint(Vector3 pos)
    {
        Camera        cam = Camera.main;
        MovableCamera mc  = cam.transform.parent.GetComponent <MovableCamera>();

        mc.targetPivot = pos;
    }
Exemplo n.º 4
0
    public void Update()
    {
        //button inputs for camera
        //rotate-left, rotate-right, tilt-up, tilt-down, zoom-in, zoom-out
        MovableCamera mc = Camera.main.transform.parent.GetComponent <MovableCamera>();

        if (Input.GetButton("Rotate Left"))
        {
            if (!mc.IsMoving)
            {
                mc.targetRotation = (float)SRPGUtil.LockFacing(mc.targetRotation - 90, FacingLock.Ordinal);
            }
        }
        if (Input.GetButton("Rotate Right"))
        {
            if (!mc.IsMoving)
            {
                mc.targetRotation = (float)SRPGUtil.LockFacing(mc.targetRotation + 90, FacingLock.Ordinal);
            }
        }
        if (Input.GetButton("Tilt Up"))
        {
            if (Mathf.Approximately(mc.targetTilt, 30) && !mc.IsMoving)
            {
                mc.targetTilt = 45;
            }
        }
        if (Input.GetButton("Tilt Down"))
        {
            if (Mathf.Approximately(mc.targetTilt, 45) && !mc.IsMoving)
            {
                mc.targetTilt = 30;
            }
        }
        if (Input.GetButton("Zoom In"))
        {
            if (Mathf.Approximately(mc.targetDistance, 45) && !mc.IsMoving)
            {
                mc.targetDistance = 30;
            }
        }
        if (Input.GetButton("Zoom Out"))
        {
            if (Mathf.Approximately(mc.targetDistance, 30) && !mc.IsMoving)
            {
                mc.targetDistance = 45;
            }
        }
        //also, if we're in an active skill, make the selected tile the target pivot
        if (activeSkill != null)
        {
            if (activeSkill is ActionSkillDef)
            {
                FocusOnPoint(map.TransformPointWorld(((ActionSkillDef)activeSkill).TargetPosition));
            }
        }
    }
Exemplo n.º 5
0
    public void FocusOnCharacter(Character c)
    {
        if (c == null)
        {
            return;
        }
        Camera        cam = Camera.main;
        MovableCamera mc  = cam.transform.parent.GetComponent <MovableCamera>();

        mc.targetPivot = c.transform.position;
    }