1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- using UnityEngine;
- using System.Collections;
- using System.Collections.Generic;
- public class WoodenDummyManager : MonoBehaviour {
- public Vector2[] bluePosArr;
- public float checkInterval = 1.5f;
- private float lastCheckTime;
- private int index = 0;
- // Use this for initialization
- void Start ()
- {
- // lastCheckTime = GameTime.time;
- }
- // Update is called once per frame
- void Update ()
- {
- if(GameTime.time - lastCheckTime < checkInterval)
- return;
- lastCheckTime = GameTime.time;
- List<CraftConfigData> list = CraftManager.GetInstance ().GetDataList ();
- if (index >= list.Count)
- {
- enabled = false;
- return;
- }
- Create(list[index].id, index, TeamUtil.Team.Blue, bluePosArr[index]);
- index++;
- }
- private int Create(int craftId, int index, TeamUtil.Team team, Vector2 pos)
- {
- BattleSession battleSession = Session.GetInstance().GetBattleSession();
- if (battleSession == null || battleSession.myPlayer == null)
- return 0;
- float x = pos.x;
- float y = pos.y;
-
- CraftData craftData = new CraftData(craftId);
- craftData.id = 1000 + index;
- craftData.userId = battleSession.myPlayer.userId;
- craftData.position = new Vector3(x, 0, y);
- craftData.team = team;
- craftData.aiType = AI.AIType.Show;
-
- craftData.nick = "";
- craftData.isHero = true;
- battleSession.GetBattleController().CreateCapsule(craftData);
- return 1;
- }
- }
|