예제 #1
0
        void Update()
        {
            if (currentTool != null)
            {
                if (Input.GetMouseButtonDown(0) && !IsPointerOverUIObject())
                {
                    currentTool.OnMouseDown(Camera.main.ScreenToWorldPoint(Input.mousePosition));
                }

                if (Input.GetMouseButton(0) && !IsPointerOverUIObject())
                {
                    currentTool.OnMouse(Camera.main.ScreenToWorldPoint(Input.mousePosition));
                }

                if (Input.GetMouseButtonUp(0) && !IsPointerOverUIObject())
                {
                    currentTool.OnMouseUp(Camera.main.ScreenToWorldPoint(Input.mousePosition));
                }

                if ((Input.GetMouseButtonDown(0) || Input.GetMouseButton(0) || Input.GetMouseButtonUp(0)) && !IsPointerOverUIObject())
                {
                    currentTool.OnMouseAny(Camera.main.ScreenToWorldPoint(Input.mousePosition));
                }
            }

            MovingPlatformMotor2D newPlatform = motor.connectedPlatform;

            if (platform != null && newPlatform == null)
            {
                GSShip ship = platform.GetComponent <GSShip> ();

                if (ship != null)
                {
                    if (enableCameraZoomOut)
                    {
                        Camera.main.orthographicSize /= 4;
                    }

                    ship.hasCharacter = false;
                }

                platform = null;
            }
            else if (platform == null && newPlatform != null)
            {
                GSShip ship = newPlatform.GetComponent <GSShip> ();

                if (ship != null)
                {
                    if (enableCameraZoomOut)
                    {
                        Camera.main.orthographicSize *= 4;
                    }

                    ship.hasCharacter = true;
                }

                platform = newPlatform;
            }
        }
예제 #2
0
 public void Init(LevelElevator elevator)
 {
     _mpMotor          = GetComponent <MovingPlatformMotor2D>();
     _mpMotor.velocity = Vector2.zero;
     _elevator         = elevator;
     _mpMotor.position = elevator.Points.pointA;
 }
예제 #3
0
 // Use this for initialization
 void Start()
 {
     _mpMotor          = GetComponent <MovingPlatformMotor2D>();
     _startingX        = transform.position.x;
     _mpMotor.velocity = -Vector2.right * speed;
     lastTime          = Time.time;
 }
예제 #4
0
        // Use this for initialization
        void Start()
        {
            _mpMotor = GetComponent<MovingPlatformMotor2D>();
            _mpMotor.onPlatformerMotorContact += PlayerContact;

            _renderer = GetComponent<SpriteRenderer>();
            _originalColor = _renderer.color;
        }
예제 #5
0
        // Use this for initialization
        void Start()
        {
            _mpMotor = GetComponent <MovingPlatformMotor2D>();
            _mpMotor.onPlatformerMotorContact += PlayerContact;

            _renderer      = GetComponent <SpriteRenderer>();
            _originalColor = _renderer.color;
        }
예제 #6
0
        // Use this for initialization
        void Start()
        {
            _mpMotor = GetComponent <MovingPlatformMotor2D>();
            _mpMotor.onPlatformerMotorContact += PlayerContact;
            _originalY = transform.position.y;

            _moveUpFunc   = EasingFunctions.GetEasingFunction(moveUpEase);
            _moveDownFunc = EasingFunctions.GetEasingFunction(moveDownEase);
        }
예제 #7
0
        // Use this for initialization
        void Start()
        {
            returnToStart = GetComponent <BoxCollider2D>();


            _mpMotor          = GetComponent <MovingPlatformMotor2D>();
            _startingX        = transform.position.x;
            _mpMotor.velocity = -Vector2.right * speed;
        }
        // Use this for initialization
        void Start()
        {
            _mpMotor   = GetComponent <MovingPlatformMotor2D>();
            _startingX = transform.position.x;

            //防呆,不然會在0秒內快速切換
            if (time <= 1)
            {
                time = 1;
            }
        }
    // Initialization
    void Start()
    {
        motor = GetComponent <MovingPlatformMotor2D>();

        av2GlobalWaypoints = new Vector2[aLocalWaypoints.Length];

        if (aLocalWaypoints.Length > 1)
        {
            for (int i = 0; i < av2GlobalWaypoints.Length; i++)
            {
                av2GlobalWaypoints[i] = (Vector2)transform.position + aLocalWaypoints[i].v2Position;
            }

            iNextWaypointIndex = 1;
            transform.position = av2GlobalWaypoints[0];

            CalculateNewVelocity();
        }
        else
        {
            Debug.LogError("Cannot activate moving platform as there are not enough waypoints.");
            Deactivate();
        }
    }
예제 #10
0
        // Use this for initialization
        void Start()
        {
            _mpMotor = GetComponent<MovingPlatformMotor2D>();
            _mpMotor.onPlatformerMotorContact += PlayerContact;
            _originalY = transform.position.y;

            _moveUpFunc = EasingFunctions.GetEasingFunction(moveUpEase);
            _moveDownFunc = EasingFunctions.GetEasingFunction(moveDownEase);
        }
예제 #11
0
 // Use this for initialization
 void Start()
 {
     _mpMotor = GetComponent<MovingPlatformMotor2D>();
     _startingX = transform.position.x;
     _mpMotor.velocity = -Vector2.right * speed;
 }
예제 #12
0
 // Use this for initialization
 void Start()
 {
     _mpMotor          = GetComponent <MovingPlatformMotor2D>();
     _startingY        = transform.position.y;
     _mpMotor.velocity = Vector2.up * speed;
 }
예제 #13
0
 // Use this for initialization
 void Start()
 {
     _mpMotor = GetComponent <MovingPlatformMotor2D>();
 }
예제 #14
0
 // Use this for initialization
 void Start()
 {
     _mpMotor          = GetComponent <MovingPlatformMotor2D>();
     _mpMotor.velocity = -Vector2.right * speed;
     lastTime          = Time.time;
 }
예제 #15
0
 // Use this for initialization
 void Start()
 {
     _mpMotor = GetComponent<MovingPlatformMotor2D>();
     _startingY = transform.position.y;
     _mpMotor.velocity = Vector2.up * speed;
 }