Пример #1
0
    // parses unitData to set own variables
    public void LoadData()
    {
        // set parameters
        portrait        = StartData.portrait;
        unitName        = StartData.unitName;
        sprites         = StartData.sprites;
        health          = StartData.health;
        moveSpeed       = StartData.moveSpeed;
        damageReduction = 0;

        // convert the unitData's list of ability enums into real abilities, and store them
        AvailableAbilities = AbilityDatabase.GetAbilities(StartData.abilities);

        // positional setup
        ChangeDirection(Direction.S);
        if (StartData.moveSoundEventName != "" || StartData.moveSoundEventName == null)
        {
            moveSoundEvent = FMODUnity.RuntimeManager.CreateInstance(StartData.moveSoundEventName);
        }
        if (!moveSoundEvent.isValid())
        {
            Debug.LogWarning("Move Event for " + unitName + " invalid.");
        }

        if (StartData.deathSoundEventName != "" || StartData.deathSoundEventName == null)
        {
            deathSoundEvent = FMODUnity.RuntimeManager.CreateInstance(StartData.deathSoundEventName);
        }
        if (!deathSoundEvent.isValid())
        {
            Debug.LogWarning("Death Event for " + unitName + " invalid.");
        }

        if (StartData.selectSoundEventName != "" || StartData.selectSoundEventName == null)
        {
            selectSoundEvent = FMODUnity.RuntimeManager.CreateInstance(StartData.selectSoundEventName);
        }
        if (!moveSoundEvent.isValid())
        {
            Debug.LogWarning("Select Event for " + unitName + " invalid.");
        }
    }