public override bool activate(rpg_character attacker, attack_entity triggering_attack) { bool has_dashed = false; for (int i = 0; i < triggering_attack.target_squares.Count; i++) { if (util_ref.e_manager.is_occupied(triggering_attack.target_squares[i])) { GameObject target = util_ref.e_manager.get_at_square(triggering_attack.target_squares[i]); Vector3 adjacent = attacker.transform.position - target.transform.position; adjacent = adjacent.normalized; adjacent = target.transform.position + adjacent; adjacent = new Vector3(Mathf.Round(adjacent.x), Mathf.Round(adjacent.y), 0); GameObject afterimage = GameObject.Instantiate(util_ref.sprite_prefab); afterimage.transform.position = attacker.transform.position; afterimage.GetComponent <SpriteRenderer>().sprite = attacker.GetComponent <SpriteRenderer>().sprite; afterimage.AddComponent <fade_effect>(); afterimage.GetComponent <fade_effect>().speed = .75f; //Debug.Log("Adjacent square is: " + adjacent.ToString()); attacker.transform.position = adjacent; util_ref.v_manager.refresh_fog(); has_dashed = true; } } return(has_dashed); }
/* * private void OnTriggerEnter2D(Collider2D collision) * { * if (collision.gameObject.tag == "Player") * { * Debug.Log("Detected collision entering " + gameObject.name); * collision.gameObject.GetComponent<player_script>().inv.pickup(attached_item); * * Destroy(gameObject); * } * } */ public override void interact(rpg_character actor) { if (actor.gameObject.tag == "Player") { actor.GetComponent <player_script>().inv.pickup(attached_item); Destroy(gameObject); } }
public override void interact(rpg_character actor) { if (actor.stats.get_stat_value("Gold") < requires_gold) { return; } else { actor.stats.get_stat("Gold").set_value(actor.stats.get_stat_value("Gold") - requires_gold); actor.GetComponent <player_script>().inv.pickup(associated_item); Destroy(gameObject); } }
public override bool activate(rpg_character attacker, attack_entity triggering_attack) { if (triggering_attack.activated_effect) { if (attacker.type == character_type.enemy) { attacker.queued_attack = replacement_skill; } else if (attacker.type == character_type.player) { attacker.GetComponent <player_script>().inv.swap_skill(triggering_attack, replacement_skill); } } return(triggering_attack.activated_effect); }