Beispiel #1
0
    }                               //yohan added


    public virtual void Init()
    {
        // Initialization

        if (gameObject.name == "Player")
        {
            //stats = SaveSystem.LoadStats();
            //stats.maxHP = SaveSystem.LoadStats().maxHP;
            stats = new Stats(initHP, initAtt, initSpeed, initAttSpeed, initDefence, initCriticalChance);
        }
        else
        {
            stats = new Stats(initHP, initAtt, initSpeed, initAttSpeed, initDefence, initCriticalChance);
        }
        InitInput();
        InitInventory();
        movement = GetComponent <IMovement>();
        combat   = GetComponent <ICombat>();
        movement.Init(this);
        combat.Init(this);
        gm = GameObject.FindWithTag("GameController").GetComponent <GameManager>();
        damageTextPrefab = Resources.Load <GameObject>("Prefabs/DamageText");
        dialogTextPrefab = Resources.Load <GameObject>("Prefabs/StateUIs/FloatingDialog");
        GameObject stateUIInstance = Instantiate(stateUIPrefab, Vector3.zero, Quaternion.identity) as GameObject;

        stateUI = stateUIInstance.GetComponentInChildren <StateUI>();
        InitStateUI();

        animationManager = GetComponent <AnimationManager>();
        if (animationManager != null)
        {
            animationManager.Init();
        }
        IsAlive              = true;
        ActivateAutoAim      = true;
        drops                = new Drops(creditDrop, energyDrop);
        gm.WorldColorChange += OnWorldColorChange;
        audioManager         = FindObjectOfType <AudioManager>();
    }