Ejemplo n.º 1
0
    private void AllowPlayerMovementControl()
    {
        // Allow player to move only if no animation is occuring.
        if (isPlayerControlLocked == false)
        {
            float playerMoveInput_Horizontal = Input.GetAxis("Horizontal");
            float playerMoveInput_Vertical   = Input.GetAxis("Vertical");

            // Add force to virus object to move it via player control input.
            Vector2 movement = new Vector2(playerMoveInput_Horizontal, playerMoveInput_Vertical);
            VirusRigidBody2D.AddForce(movement * virusMovementSpeed);
        }
    }
Ejemplo n.º 2
0
    private IEnumerator MoveVirusThroughCell(Vector3 touchedCellHeading, float pullVirusAnimationEndTime)
    {
        while (Time.time < pullVirusAnimationEndTime)
        {
            // Apply force to player to pull player into cell. Need to do this only as long as it takes to move player into cell.
            VirusRigidBody2D.AddForce(touchedCellHeading * 0.03f);
            yield return(null);
        }

        Debug.Log("Sucessfully exited MoveVirusThroughCell Coroutine.");

        // Player regains control once animation complete. Switch player to naked virus capsid sprite.
        VirusColliderOn();
        isPlayerControlLocked = false;
        ChangeVirusSpeedToDefault();
        ChangeSpriteToNakedCapsid();
        ChangeVirusColliderRadiusToAdenovirus();
        insideCell = true;
    }