Example #1
0
        private IEnumerator Walk(LivableEntity npc, float distance, float time)
        {
            var target = npc.transform.position.x + distance;
            // 速さ = 距離 / 時間
            var speed = distance / time;

            if (float.IsNaN(speed) || float.IsInfinity(speed))
            {
                npc.transform.position = new Vector3(target, npc.transform.position.y, npc.transform.position.z);
                yield break;
            }
            npc.Move(speed);
            yield return(new WaitForSeconds(time));

            npc.Move(0);
            npc.transform.position = new Vector3(target, npc.transform.position.y, npc.transform.position.z);
        }
Example #2
0
 public void SpClr(LivableEntity npc)
 {
     Destroy(npc.gameObject);
 }
Example #3
0
 public LivableEntity SpOfs(LivableEntity sprite, Vector2 pos)
 {
     sprite.transform.position = pos;
     return(sprite);
 }
Example #4
0
 private LivableEntity SpDir(LivableEntity sprite, SpriteDirection dir)
 {
     sprite.Direction = dir;
     return(sprite);
 }
Example #5
0
 public LivableEntity SpChr(LivableEntity sprite, string animId)
 {
     sprite.ChangeSprite(animId);
     return(sprite);
 }