internal void ImportBodyTrigger() { string ExportFilePath = Path.Combine(SavePath, SaveFile["Body"]); if (!File.Exists(ExportFilePath)) { Logger.LogMessage($"[ImportBodyTrigger] {ExportFilePath} file doesn't exist"); return; } List <RouteRule> data = JSONSerializer.Deserialize <List <RouteRule> >(File.ReadAllText(ExportFilePath)); if (data?.Count == 0) { Logger.LogMessage($"[ImportBodyTrigger] no rule to import"); return; } int skipped = 0; foreach (RouteRule rule in data) { if (BodyTrigger.Any(x => x.GameObjectPath == rule.GameObjectPath && x.OldName == rule.OldName && x.NewName == rule.NewName)) { skipped++; continue; } BodyTrigger.Add(rule); } BodyTrigger = SortRouteRules(BodyTrigger); Logger.LogMessage($"[ImportBodyTrigger] {data?.Count - skipped} rule(s) imported, {skipped} rule(s) skipped"); }
protected virtual void Start() { bodyTrigger = GetComponentInChildren <BodyTrigger>(); myUnitScript = GetComponent <UnitScript>(); CombatController.Instance.AttackEvent += OnAttack; TurnManager.Instance.NewTurnEvent += OnNewTurn; stepSource = gameObject.AddComponent <AudioSource>(); CurrMoveSpeed = baseMoveSpeed; Destination = transform.position; VISUAL_MOVEMENT_SPEED = visualMovementSpeed * PlayerPrefs.GetFloat("moveSpeedAnimation"); }