// Use this for initialization void Start() { sprite = GetComponent <SpriteRenderer>(); occupant = GetComponentInChildren <UnitActor>(); action_ui_controller = GameObject.FindObjectOfType <ActionUIController>(); is_active = false; }
HitMissInfo get_hit_miss_info(UnitActor other, bool is_melee = true, float range = 0) { Stats actor_stats = actor.stats; Stats other_stats = other.stats; float attacker_accuracy = actor_stats.dexterity + actor_stats.dexterity_plus + actor_stats.level; float other_dodge = other_stats.agility + other_stats.agility_plus + other_stats.level; float copy_of_attacker_accuracy = attacker_accuracy; RangePenaltyInfo range_penalty_info = new RangePenaltyInfo(attacker_accuracy); if (!is_melee) { range_penalty_info = accuracy_range_modifier(attacker_accuracy, range); attacker_accuracy = range_penalty_info.accuracy; //accuracy_range_modifier(attacker_accuracy, range); } HitMissInfo roll = roll_hit_dice(attacker_accuracy, other_dodge); roll.attacker_accuracy = copy_of_attacker_accuracy; roll.other_dodge = other_dodge; roll.range_penalty_info = range_penalty_info; Debug.Log("Accuracy = " + roll.attacker_accuracy + " | Dodge = " + roll.other_dodge); Debug.Log("Range Bonus: " + (-roll.range_penalty_info.penalty * 100) + "%"); Debug.Log("Hit Chance: " + roll.reported_hit_chance * 100 + "%"); return(roll); }
public void set_actor(UnitActor _actor) { //actor = _actor; //actor.highlight_as_active(); //actor.set_default_action(); //tooltip.text = actor.get_tooltip(); }
void spawn_unit_actor(string name, float ap_fill_rate, int a, int b, int c) { GameObject unit = tactical_map.place_unit(a, b, c); UnitActor actor = unit.GetComponent <UnitActor>(); actor.initialize(ap_fill_rate, turn_meter_controller); turn_meter_controller.register_actor(name, actor); }
public void register_actor(string identifier, UnitActor actor) { GameObject marker = Instantiate(Resources.Load("TurnMeterMarker")) as GameObject; actors.Add(identifier, actor); markers.Add(identifier, marker); set_marker_position(identifier); }
// Use this for initialization void Start() { actor = GetComponent <UnitActor>(); equips_loader = GetComponent <EquipsLoader>(); anatomy = actor.anatomy; //GetComponent<SlottableAnatomy>(); validator = GameObject.Find("Validator").GetComponent <SlottableAnatomy>(); begin_test(); print_test_result(); }
public Unit() { inventory = new UnitInventory(); items = new UnitItems(); unitInfo = new UnitInfo(); unitClass = new UnitClass(); status = new UnitStatus(); unitActor = new UnitActor(); idx = ""; unitID = ""; }
// Use this for initialization void Start() { equips_loader = GetComponent <EquipsLoader>(); techs_loader = GetComponent <TechsLoader>(); actor_a = GameObject.Find("actor_a").GetComponent <UnitActor>(); actor_b = GameObject.Find("actor_b").GetComponent <UnitActor>(); actor_a.assign_item_loader(equips_loader.get_equips()); actor_a.assign_tech_loader(techs_loader.get_techs()); actor_b.assign_item_loader(equips_loader.get_equips()); actor_b.assign_tech_loader(techs_loader.get_techs()); begin_test(); }
public void deliver_to(UnitActor other, string action) { switch (action) { case "marksmanship_double_tap": EquipData eq = actor.check_has_equipment_with_attributes("is_bow"); if (eq != null) { List <EquipData> ammo = actor.use_ammo("arrow_iron"); if (ammo.Count >= 1) { if (is_strictly_hit(other, IS_RANGED, get_delta_range(eq, other))) { float damage = eq.base_damage + ammo[0].base_damage; if (actor.has_tech("marksmanship_bow")) { damage = Mathf.Pow(damage, (DEX_CA + actor.stats.dexterity) / DEX_CB); } Debug.Log("Damage = " + damage); } else { Debug.Log("Missed!"); } } else { throw new System.InvalidOperationException("Actor does not have available arrows"); } } else { throw new System.InvalidOperationException("Actor does not have bow equipment"); } break; } }
void tick_all_actors() { foreach (KeyValuePair <string, UnitActor> pair in actors) { UnitActor actor = pair.Value; float ap = actor.tick(); set_marker_position(pair.Key, actor.time_to_full()); if (ap > 100f) { queued_actors.Add(pair.Key); } } if (queued_actors.Count > 0) { set_actor(); } else { run_turn_meter(true); } }
//public EquipData check_has_equipment_with_attributes(List<string> attbs) { // return anatomy.check_has_equipment_with_attributes(attbs); //} #endregion #region Interaction public void deliver_to(UnitActor other, string action) { interaction.deliver_to(other, action); }
bool is_strictly_hit(UnitActor other, bool is_melee = true, float range = 0) { return(get_hit_miss_info(other, is_melee, range).is_hit); }
float get_range_from(UnitActor other) { return(Vector3.Distance(actor.transform.position, other.transform.position)); }
// Use this for initialization void Start() { action_canvas = GameObject.Find("ActionCanvas").GetComponent <Canvas>(); tooltip = GameObject.Find("ActionTooltip").GetComponent <Text>(); actor = null; }
public void set_parent_actor(UnitActor _p) { actor = _p; }
float get_delta_range(EquipData eq, UnitActor other) { // Negative value = less than weapon's max range = bonus accuracy return(get_range_from(other) - eq.range); }
public void set_parent_actor(UnitActor unit_actor) { actor = unit_actor; }
public void set_parent_actor(UnitActor parent) { parent_actor = parent; }