예제 #1
0
    public void resetHP()
    {
        this.hp = 100;

        if (GameManager.instance != null)
        {
            GameManager.instance.hp = 100;
        }

        hpControl.setValue(this.hp);
    }
예제 #2
0
    void Start()
    {
        characterController = GetComponent <CharacterController>();
        animator            = GetComponent <Animator>();
        joystick            = GameObject.Find("Variable Joystick").GetComponent <VariableJoystick>();
        state             = ActionState.Idle;
        camera            = GameObject.Find("FirstPersonView").GetComponent <Camera>();
        this.cameraOffset = Camera.main.transform.position - this.transform.position;
        hpControl         = (HealthBarControl)GameObject.FindGameObjectWithTag("HPBar").GetComponent(typeof(HealthBarControl));
        coldControl       = (ManaBarControl)GameObject.FindGameObjectWithTag("ManaBar").GetComponent(typeof(ManaBarControl));
        frostEffect       = GameObject.Find("FirstPersonView").GetComponent <FrostEffect>();

        if (GameManager.instance != null)
        {
            this.hp     = GameManager.instance.hp;
            this.coldHp = GameManager.instance.coldHp;

            hpControl.setValue(this.hp);
            coldControl.setValue(this.coldHp);

            this.transform.position = GameManager.instance.position;
            this.transform.rotation = GameManager.instance.rotation;
        }

        Debug.Log("Start for Player: hp " + this.hp + ", coldHp: " + this.coldHp + ", position: " + this.transform.position
                  + "instance position: " + GameManager.instance.position);
    }