예제 #1
0
    // Start is called before the first frame update
    void Start()
    {
        PlayerData data = SaveSystem.LoadPlayer();

        if (data.health != 0)
        {
            currentHealth = data.health;
        }
        if (data.position[0] != 0 && data.position[2] != 0)
        {
            Vector3 position;

            position.x         = data.position[0];
            position.y         = data.position[1];
            position.z         = data.position[2];
            transform.position = position;
        }

        target        = GameObject.FindGameObjectWithTag("Enemy").GetComponent <Transform>();
        joystick      = FindObjectOfType <Joystick>();
        attackButton  = FindObjectOfType <JoyButton>();
        defendButton  = FindObjectOfType <DefendButton>();
        anim          = GetComponent <Animation>();
        currentHealth = maxHealth;
        healthBar.SetMaxHealth(maxHealth);
        startPosition = this.gameObject.transform.position;
    }
예제 #2
0
 // Start is called before the first frame update
 void Start()
 {
     target        = GameObject.FindGameObjectWithTag("Enemy").GetComponent <Transform>();
     joystick      = FindObjectOfType <Joystick>();
     attackButton  = FindObjectOfType <JoyButton>();
     defendButton  = FindObjectOfType <DefendButton>();
     anim          = GetComponent <Animation>();
     currentHealth = maxHealth;
     healthBar.SetMaxHealth(maxHealth);
     startPosition = this.gameObject.transform.position;
 }