예제 #1
0
        public static string Translate(StairType stairType)
        {
            var prop = typeof(StairType).GetField(Enum.GetName(typeof(StairType), stairType));
            var attr = (DescriptionAttribute)prop.GetCustomAttributes(typeof(DescriptionAttribute), false)[0];

            return(attr.Description);
        }
예제 #2
0
 public Stair(int y, int x, StairType s) : base(Properties.Resources.Stair_Down, y, x)
 {
     Name      = "stairway";
     StairType = s;
     if (s == StairType.Up)
     {
         Description = "A set of stairs leading up.";
         Image       = Properties.Resources.Stair_Up;
     }
     else
     {
         Description = "A set of stairs leading down.";
     }
     IsWalkable = true;
 }
예제 #3
0
    public GameObject genStairAtRandom(StairType stairType = StairType.Normal)
    {
        Vector2 genPos = Vector2.Lerp(genPosBegin, genPosEnd, Random.value);

        GameObject prefab;

        switch (stairType)
        {
        case StairType.OnFire:
            prefab = fireStairPrefab;
            break;

        default:
            prefab = stairPrefab;
            break;
        }

        GameObject newStair = Instantiate(
            prefab,
            genPos,
            Quaternion.identity,
            transform
            );

        switch (stairType)
        {
        case StairType.Moving:
            MovingStair moving = newStair.AddComponent <MovingStair> ();
            moving.maxX            = Mathf.Min(genPos.x + movingRange, genPosEnd.x);
            moving.minX            = Mathf.Max(genPos.x - movingRange, genPosBegin.x);
            moving.speed           = movingSpeed;
            moving.turnaroundSound = turnaroundSound;
            break;

        case StairType.OnFire:
            DamagingTouch damaging = newStair.AddComponent <DamagingTouch> ();
            damaging.gameController = FindObjectOfType <GameController> ();
            damaging.hurt           = 10f;
            break;
        }

        return(newStair);
    }
예제 #4
0
파일: Stairs.cs 프로젝트: svwilke/Spellzee
 /// <summary>
 /// De-serialize the component
 /// </summary>
 /// <param name="reader">Reader instance</param>
 public override void Read(BinaryReader reader)
 {
     floor = reader.ReadInt32();
     type  = (StairType)reader.ReadInt32();
 }