예제 #1
0
    // Use this for initialization
    void Awake()
    {
        playerControl = gameObject.GetComponent<Player_Control> ();

        player = GetComponent<Rigidbody2D> ();
        playerSprite = GetComponent<SpriteRenderer> ();
        playerAnimation = GetComponent<Animator> ();

        playerSpeed = 5.0f;
        playerHP = maxHP = 3;
        nextVuln = 0.0f;
        invincTime = 2.0f;
        playerAlive = true;

        upVec = new Vector2 (0, playerSpeed);
        rightVec = new Vector2 (playerSpeed, 0);
        upRightVec = new Vector2 (Mathf.Sqrt (2) / 2 * playerSpeed, Mathf.Sqrt (2) / 2 * playerSpeed);
        downRightVec = new Vector2 (Mathf.Sqrt (2) / 2 * playerSpeed, -Mathf.Sqrt (2) / 2 * playerSpeed);
        offset = new Vector2 (0, 0.8f);
        screenSize = new Vector2 (4.5f, 5.4f);

        gameOver = GameObject.Find ("Canvas").GetComponent<Game_Over_Script> ();

        keyCount = 0;
        maxKeys = 5;
    }
예제 #2
0
 // Use this for initialization
 void Start()
 {
     screenSize = Player_Control.screenSize;
     gameOver = GameObject.Find ("Canvas").GetComponent<Game_Over_Script> ();
 }