static void SpawnPlayer(string className, Vector3 pos) { CharStatsInfo info = CharStatsInfo.Find(className); var player = new GameObject("Player"); player.tag = "Player"; player.transform.position = pos; var character = player.AddComponent <Character>(); character.basePath = @"data\global\chars"; character.token = info.token; character.weaponClass = info.baseWClass; character.directionCount = 16; character.run = true; character.walkSpeed = 7; character.runSpeed = 15; character.maxHealth = 1000; character.health = 1000; character.size = 2; character.equip = player.AddComponent <Equipment>(); Inventory.Create(player, 10, 4); var body = player.AddComponent <Rigidbody2D>(); body.isKinematic = true; var collider = player.AddComponent <CircleCollider2D>(); collider.radius = Iso.tileSizeY; var listenerObject = new GameObject("Audio Listener"); listenerObject.AddComponent <AudioListener>(); listenerObject.transform.SetParent(player.transform, true); listenerObject.transform.localPosition = new Vector3(0, 0, -1); PlayerController.instance.SetCharacter(character); foreach (var startingItem in info.startingItems) { if (startingItem.code == null) { continue; } var itemInfo = ItemInfo.Find(startingItem.code); for (int i = 0; i < startingItem.count; ++i) { var item = new Item(itemInfo); if (startingItem.loc != null) { int loc = BodyLoc.GetIndex(startingItem.loc); character.equip.Equip(item, loc); } else { PlayerController.instance.Take(item); } } } }
public void OnPointerExit(PointerEventData eventData) { CharStatsInfo classInfo = CharStatsInfo.Find(className); dummyAnimator.selected = false; dummyAnimator.cof = GetCof(classInfo, "TN"); OnExit(classInfo); }
public void OnPointerEnter(PointerEventData eventData) { CharStatsInfo classInfo = CharStatsInfo.Find(className); dummyAnimator.selected = true; dummyAnimator.cof = GetCof(classInfo, "SC"); OnEnter(classInfo); }
void Start() { CharStatsInfo classInfo = CharStatsInfo.Find(className); dummy = CreateDummy(classInfo, new Vector3(0, 0)); dummyAnimator = dummy.GetComponent <COFAnimator>(); dummyAnimator.cof = GetCof(classInfo, "TN"); }
private void Awake() { Canvas.ForceUpdateCanvases(); rectTransform = GetComponent <RectTransform>(); className = name; CharStatsInfo classInfo = CharStatsInfo.Find(className); dummy = CreateDummy(classInfo); dummy.transform.position = Camera.main.ScreenToWorldPoint(rectTransform.position); dummyAnimator = dummy.GetComponent <COFAnimator>(); dummyAnimator.cof = GetCof(classInfo, "TN"); }
public void OnPointerClick(PointerEventData eventData) { CharStatsInfo classInfo = CharStatsInfo.Find(className); OnClick(classInfo); }