Categories
Uncategorized

Animator Quick Fix

sometimes the standalone player will turn off the animator for npc’s and monsters. The easiest quick fix for this problem is to force them on. Here is the quick solution, and it really works wonders.

public class animatorfixer : MonoBehaviour
{
    public Animator anim;
    // Start is called before the first frame update
    void Start()
    {
       
    anim = GetComponent<Animator>();
        anim.enabled = true;
   }
}
Categories
Uncategorized

Audio with Unity

To incorporate the sounds into this game a custom script was written which handles the audio clips. There is a Master clip and 2 children.

public class zonemusic1 : MonoBehaviour
{ 
public audiomaster audiomaster;
public AudioClip clip1;


void OnTriggerEnter(Collider other)
{
        if (other.CompareTag("Player"))
        {
            audiomaster.play(clip1);  //from audiomaster

        }

    }

void OnTriggerExit(Collider other)
{
        if (other.CompareTag("Player"))
        {
            audiomaster.stop();
        }
    }
}

zone music handles the audio source collision logic for the audio master. There are 3 empty game objects, one parent and two children. The variables for the audio source and audio master are assigned in the inspector window as follows.

The sound master uses the following code to handle playing the first song throughout the login/character selection/and first zone. This seamless transition is then altered when collisions are detected n the zonemusic class. There is logic for a slider that is then assigned for the soundmaster to be handled in the main menu.

public class audiomaster : MonoBehaviour
{
    public Slider volumeSlider;
    public AudioSource audiosource;
    public AudioClip defaultClip;  //the default clip that will play at start up
    void Start()
    {
        audiosource.clip = defaultClip;
        audiosource.Play();
        
    }
    

    public void play(AudioClip clip1){
        if (clip1.name == audiosource.clip.name && audiosource.isPlaying) { return; } //if were already playign the default clip
audiosource.clip = clip1;
        audiosource.Play();
}

public void stop(){
        if (defaultClip == audiosource.clip) {  return; }
        audiosource.clip = defaultClip;//when exiting trigger can revert to default audioclip
        audiosource.Play();
    }

    void OnEnable()
    {
        //Register Slider Events
        volumeSlider.onValueChanged.AddListener(delegate { changeVolume(volumeSlider.value); });
    }

    //Called when Slider is moved
    void changeVolume(float sliderValue)
    {
        audiosource.volume = sliderValue;
    }

    void OnDisable()
    {
        //Un-Register Slider Events
        volumeSlider.onValueChanged.RemoveAllListeners();
    }
}

Variables for the slider and Default clip are assigned in the inspector as follows.

Categories
Uncategorized

Featuring Dynamic Bone

I had a cape controller that I wrote myself, but I lost it. Actually I made it again, and then lost it again. So on my third attempt I contacted some professionals and they said to use Dynamic Bone. So far it looks good while running, still having problems with fast root animations. Looks good and the price is right, though. Have a look here: https://assetstore.unity.com/packages/tools/animation/dynamic-bone-16743

Categories
Uncategorized

New Textures

Started texturing old models to give the game a little more pizzaz, they’re coming out pretty nicely.

Categories
Uncategorized

Floating Islands

Former resting place of Inferno the Dragon, now this island provides housing for the gnomes that sparkle this magical land.

Categories
Uncategorized

Purple Dragons

Utilizing Burny’s swim/fly addon available on the ummorpg website flying is possible with almost any asset from the asset store. Here we can see The Dragon flying with relative ease!

Categories
Uncategorized

Charge tests

Using projectiles we can simulate a charge attack by instantiating a player over the projectile and swapping positions during teleport. This is a project that we’ve been working on here in the office.

Categories
Uncategorized

Dealing with combat

Fixed the cursor, still having trouble with fireball prefabs. Server has been up since last night. The combat log isn’t working. Colliders seem to have a sweet spot of around 2m, any closer or further away and there’s no collision. Gotta clean up the old debug logs, over 1400 lines of debugs.

Categories
Uncategorized

Featuring Citadel GUI

Recently bought the Citadel GUI to polish the ui in place. Looking very good! You can find it on the Unity Asset Store here: https://assetstore.unity.com/packages/2d/gui/citadel-rpg-gui-123499

Categories
Uncategorized

invisible mouse

trying to fix the mouse to work on linux builds. Right now it only works in the editor. Possible code combinations equate to

Cursor.visible = false;
Cursor.lockState = CursorLockMode.Locked;

on mouse clicks. Also trying Cursor.SetCursor with transparent images but they show up on click before hiding.

also having trouble with prefabs on network manager. AssetID’s aren’t being found.