public void FinishAction(Entity parent) { // * check if we can currently cast a skill (enough mana etc.) // * check if we can cast THAT skill on THAT target // note: we don't check the distance again. the skill will be cast even // if the target walked a bit while we casted it (it's simply better // gameplay and less frustrating) GameObject action = Instantiate(currentData.Obj); if (!action.GetComponent <PreparedAction>()) { action.AddComponent <PreparedAction>(); } StartCoroutine(parent.LockDuringAction(currentBehaviour.actionLock)); //time spent "casting" the skill (locked in place) whereas action duration is how long it sticks around PreparedAction defaultAction = builder.ReturnPreparedAction(parent.unitData.ValueContainer); defaultAction.Initialize(parent, currentDirection); //get components and set info from Players passives }