コード例 #1
0
    // Use this for initialization
    void Start()
    {
        if (player == null)
        {
            player          = GameObject.FindGameObjectWithTag("Player").GetComponent <CustomPlatformerCharacter2D>();
            playerRigidbody = GameObject.FindGameObjectWithTag("Player").GetComponent <Rigidbody2D>();
        }

        gravity         = player.GetGravityScale(); //Save this so we can go between no gravity and full gravity
        canHoldToAttach = true;
    }
コード例 #2
0
    void Start()
    {
        hdzc = horizontalDeadZoneCenter;

        cam = GetComponent <Camera>();

        player          = GameObject.FindGameObjectWithTag("Player").GetComponent <Transform>();
        playerMov       = player.gameObject.GetComponent <CustomPlatformerCharacter2D>();
        playerRigidbody = player.gameObject.GetComponent <Rigidbody2D>();

        float   offset = (0.5f - horizontalDeadZoneCenter) / 0.4f;
        Vector3 newPos = new Vector3(player.position.x + (2.0f * offset), player.position.y + offsetY, -10f);

        gameObject.transform.position = newPos;

        GameManager.instance.OnPlayerDeath.AddListener(ResetCamera);
    }
コード例 #3
0
 private void Awake()
 {
     m_Character = GetComponent <CustomPlatformerCharacter2D>();
 }
コード例 #4
0
 private void Awake()
 {
     m_Character = GetComponent<CustomPlatformerCharacter2D>();
 }