Exemplo n.º 1
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);
    }
Exemplo n.º 2
0
    public void BreakGame()
    {
        HealthBarControl hpControl   = (HealthBarControl)GameObject.FindGameObjectWithTag("HPBar").GetComponent(typeof(HealthBarControl));
        ManaBarControl   coldControl = (ManaBarControl)GameObject.FindGameObjectWithTag("ManaBar").GetComponent(typeof(ManaBarControl));

        instance.hp     = hpControl.getValue();
        instance.coldHp = coldControl.getValue();

        Debug.Log("BreakGame(),hp: " + hp + ",coldHp: " + coldHp);
        //Debug.Log("check instance: " + hpControl.getValue());

        PlayerController player = (PlayerController)GameObject.Find("Player").GetComponent(typeof(PlayerController));

        instance.position = player.transform.position;
        instance.rotation = player.transform.rotation;

        Debug.Log("cur position: " + player.transform.position);

        recordBonfires();
        Debug.Log("Number of triggered bonfires when break: " + numOfTriggeredBonfires());
    }