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; } }
public void Init(LevelElevator elevator) { _mpMotor = GetComponent <MovingPlatformMotor2D>(); _mpMotor.velocity = Vector2.zero; _elevator = elevator; _mpMotor.position = elevator.Points.pointA; }
// Use this for initialization void Start() { _mpMotor = GetComponent <MovingPlatformMotor2D>(); _startingX = transform.position.x; _mpMotor.velocity = -Vector2.right * speed; lastTime = Time.time; }
// Use this for initialization void Start() { _mpMotor = GetComponent<MovingPlatformMotor2D>(); _mpMotor.onPlatformerMotorContact += PlayerContact; _renderer = GetComponent<SpriteRenderer>(); _originalColor = _renderer.color; }
// Use this for initialization void Start() { _mpMotor = GetComponent <MovingPlatformMotor2D>(); _mpMotor.onPlatformerMotorContact += PlayerContact; _renderer = GetComponent <SpriteRenderer>(); _originalColor = _renderer.color; }
// Use this for initialization void Start() { _mpMotor = GetComponent <MovingPlatformMotor2D>(); _mpMotor.onPlatformerMotorContact += PlayerContact; _originalY = transform.position.y; _moveUpFunc = EasingFunctions.GetEasingFunction(moveUpEase); _moveDownFunc = EasingFunctions.GetEasingFunction(moveDownEase); }
// 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(); } }
// Use this for initialization void Start() { _mpMotor = GetComponent<MovingPlatformMotor2D>(); _mpMotor.onPlatformerMotorContact += PlayerContact; _originalY = transform.position.y; _moveUpFunc = EasingFunctions.GetEasingFunction(moveUpEase); _moveDownFunc = EasingFunctions.GetEasingFunction(moveDownEase); }
// Use this for initialization void Start() { _mpMotor = GetComponent<MovingPlatformMotor2D>(); _startingX = transform.position.x; _mpMotor.velocity = -Vector2.right * speed; }
// Use this for initialization void Start() { _mpMotor = GetComponent <MovingPlatformMotor2D>(); _startingY = transform.position.y; _mpMotor.velocity = Vector2.up * speed; }
// Use this for initialization void Start() { _mpMotor = GetComponent <MovingPlatformMotor2D>(); }
// Use this for initialization void Start() { _mpMotor = GetComponent <MovingPlatformMotor2D>(); _mpMotor.velocity = -Vector2.right * speed; lastTime = Time.time; }
// Use this for initialization void Start() { _mpMotor = GetComponent<MovingPlatformMotor2D>(); _startingY = transform.position.y; _mpMotor.velocity = Vector2.up * speed; }