Example #1
0
    private void ActivateRightPlatform()
    {
        PlatformWidth = RightPlatform.GetComponent <BoxCollider2D>().size.x - 0.01f;
        Platform platform = GetPlatform();

        platform.ActivateAndSetPosition(new Vector2(RightPlatform.transform.position.x + PlatformWidth, startPoint.position.y));
        LeftPlatform.Deactivate();
        LeftPlatform         = CurrentPlatform;
        CurrentPlatform      = RightPlatform;
        RightPlatform        = platform;
        CurrentPlatformWidth = PlatformWidth;
    }
Example #2
0
    private void ActivateLeftPlatform()
    {
        Platform platform = GetPlatform();

        PlatformWidth = platform.GetComponent <BoxCollider2D>().size.x - 0.01f;
        platform.ActivateAndSetPosition(new Vector2(LeftPlatform.transform.position.x - PlatformWidth, startPoint.position.y));
        RightPlatform.Deactivate();
        RightPlatform        = CurrentPlatform;
        CurrentPlatform      = LeftPlatform;
        LeftPlatform         = platform;
        CurrentPlatformWidth = CurrentPlatform.gameObject.GetComponent <BoxCollider2D>().size.x;
    }
Example #3
0
    private void Start()
    {
        CurrentPlatform = ObjectPool.Instance.GetPlatform(PlatformType.Easy);
        CurrentPlatform.ActivateAndSetPosition(startPoint.localPosition);
        CurrentPlatformWidth = CurrentPlatform.GetComponent <BoxCollider2D>().size.x - 0.01f;

        LeftPlatform  = GetPlatform();
        PlatformWidth = LeftPlatform.GetComponent <BoxCollider2D>().size.x - 0.01f;
        LeftPlatform.ActivateAndSetPosition(new Vector2(startPoint.position.x - PlatformWidth, startPoint.position.y));

        RightPlatform = GetPlatform();
        RightPlatform.ActivateAndSetPosition(new Vector2(startPoint.position.x + CurrentPlatformWidth, startPoint.position.y));
    }