示例#1
0
    // Use this for initialization
    void Start()
    {
        anim = GetComponent <Animator>();
        string[] files = System.IO.Directory.GetFiles(Application.dataPath + "/Analys6Position/", "*", System.IO.SearchOption.TopDirectoryOnly);

        foreach (string s in files)
        {
            if (s.IndexOf(".meta") < 0)
            {
                ActPosition pos = new ActPosition(s);
                actions.Add(pos);
            }
        }
    }
示例#2
0
        public JsonResult Post([FromBody] Request value)
        {
            Random rand    = new Random();
            var    x       = rand.Next(10000000, 99999999);
            string session = x.ToString();

            Program.Logger.Debug(" > " + session + " > " + JsonConvert.SerializeObject(value));


            Result res = new Result();

            switch (value.RequestIdent)
            {
            case "PositionAdd":
                ActPosition actPosition = new ActPosition();
                res = actPosition.Add(value);
                break;

            case "PositionsGet":
                ActPosition actPositionGetAll = new ActPosition();
                res = actPositionGetAll.GetAll(value);
                break;

            case "PersonAdd":
                ActPerson actPerson = new ActPerson();
                res = actPerson.Add(value);
                break;

            case "PersonsGet":
                ActPerson actPersonGetAll = new ActPerson();
                res = actPersonGetAll.GetAll(value);
                break;

            default:
                res.Code = 105;
                res.Info = "Не найден метод";
                break;
            }

            Program.Logger.Debug(" < " + session + " < " + JsonConvert.SerializeObject(res));
            return(new JsonResult(res));
        }
示例#3
0
 void OnTriggerEnter(Collider collider)
 {
     if (collider.gameObject.tag == "Enemy")
     {
         float[,] enemyArea = EnemyArea(collider.gameObject.transform.position.x, collider.gameObject.transform.position.y, 3f, 1f);
         float[] disList = new float[actions.Count];
         int     i       = 0;
         foreach (ActPosition a in actions)
         {
             disList[i] = a.AreaChecker(enemyArea);
             i++;
         }
         ActPosition act = actions[maxIndex(disList)];
         Debug.Log(act.GetName());
         Debug.Log(act.GetFrame());
         act.DebugSphere();
         anim.Play(act.GetName(), 0, act.GetFrame());
         anim.speed = 0;
     }
 }