Answers for "unity enum"

C#
12

unity enum

using UnityEngine;
using System.Collections;

public class EnumScript : MonoBehaviour 
{
    enum Direction {North, East, South, West};

        void Start () 
    {
        Direction myDirection;
        
        myDirection = Direction.North;
    }
    
    Direction ReverseDirection (Direction dir)
    {
        if(dir == Direction.North)
            dir = Direction.South;
        else if(dir == Direction.South)
            dir = Direction.North;
        else if(dir == Direction.East)
            dir = Direction.West;
        else if(dir == Direction.West)
            dir = Direction.East;
        
        return dir;     
    }
}
Posted by: Guest on May-31-2020
3

unity enum

private enum State
{
	Idle,
    Walk,
    Attack,
}
Posted by: Guest on April-03-2020

C# Answers by Framework

Browse Popular Code Answers by Language