Beispiel #1
0
    private void PortalAnimation()
    {
        if (this.myPlayer != null && this.state == PortalAnimationState.Starting)
        {
            if (this.myPlayer.transform.position.x > this.transform.position.x)
            {
                this.isPlayerRight = true;
            }
            else
            {
                this.isPlayerRight = false;
            }

            if (this.myPlayer.transform.position.y > this.transform.position.y)
            {
                this.isPlayerUp = true;
            }
            else
            {
                this.isPlayerUp = false;
            }

            this.myPlayer.SetExternalMovementSpeed(portalAnimationSpeed);
            this.myPlayer.SetExternalMovementPoint(this.GenerateFirstDestinationPoint());
            this.myPlayer.SetZeroGravity();
            this.myPlayer.SetNoCollision();
            this.myPlayer.StartRotating();
            this.myPlayer.StartShrinking();
            this.state = PortalAnimationState.FirstMovement;
        }
    }
Beispiel #2
0
    private void OnExternalMovementFinishedEvent(object sender, EventArgs e)
    {
        switch (this.state)
        {
        case PortalAnimationState.FirstMovement:
            this.myPlayer.SetExternalMovementPoint(this.GenerateSecondDestinationPoint());
            this.state = PortalAnimationState.SecondMovement;
            break;

        case PortalAnimationState.SecondMovement:
            this.myPlayer.SetExternalMovementPoint(this.GenerateThirdDestinationPoint());
            this.state = PortalAnimationState.ThirdMovement;
            break;

        case PortalAnimationState.ThirdMovement:
            this.myPlayer.SetExternalMovementPoint(this.GenerateFourthDestinationPoint());
            this.state = PortalAnimationState.FourthMovement;
            break;

        case PortalAnimationState.FourthMovement:
            this.myPlayer.SetExternalMovementPoint(this.GenerateFifthDestinationPoint());
            this.state = PortalAnimationState.FifthMovement;
            break;

        case PortalAnimationState.FifthMovement:
            LevelLoaderSingleton.Instance.LoadNext();
            this.state = PortalAnimationState.Starting;
            break;

        default:
            break;
        }
    }
Beispiel #3
0
 void Start()
 {
     //firstTargetNode = Spawn.S.firstNode;
     currentSpeed = stats.speed;
     StartMove(firstTargetNode);
     portalAnimationState = PortalAnimationState.none;
     originalScale        = transform.localScale;
 }
Beispiel #4
0
    void FixedUpdate()
    {
        if (moveAlongPath)
        {
            MoveAlongPath();
        }

        // Portal Animation
        switch (portalAnimationState)
        {
        case PortalAnimationState.disappearing:
            float u = (Time.time - portalAnimationStartTime) / portalAnimationDuration;
            if (u > 1)
            {
                portalAnimationState = PortalAnimationState.appearing;
                transform.position   = portalTarget.transform.position;
                StartMove(portalTarget);
                u = 1;
            }
            transform.localScale = originalScale * (1 - u);
            break;

        case PortalAnimationState.appearing:
            u = (Time.time - portalAnimationStartTime) / portalAnimationDuration - 1;
            if (u > 1)
            {
                portalAnimationState = PortalAnimationState.none;
                u = 1;
            }
            transform.localScale = originalScale * (u);
            break;

        default:
            break;
        }
    }
Beispiel #5
0
 public void PortalTo(Node targetNode)
 {
     portalTarget             = targetNode;
     portalAnimationState     = PortalAnimationState.disappearing;
     portalAnimationStartTime = Time.time;
 }